Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Rename `country_iso` to `country_code` (#14442)

Damian Legawiec4df88ac68468
diff --git a/.changeset/admin-api-geography-codes.md b/.changeset/admin-api-geography-codes.md
new file mode 100644
index 0000000000..7e4de6f19c
--- /dev/null
+++ b/.changeset/admin-api-geography-codes.md
@@ -0,0 +1,8 @@
+---
+'@spree/admin-sdk': major
+'@spree/sdk': major
+---
+
+Rename the geography fields to `country_code` and `state_code` across the v3 API, replacing `country_iso` and `state_abbr`. Addresses, stock locations, delivery zone members, markets, tax rates and tax exemption certificates all use the new names, on read and on write. Markets rename their list of countries from `country_isos` to `country_codes`.
+
+Addresses keep `country_iso` and `state_abbr` as deprecated read fields and accepted write names for one release, so existing storefronts keep working; both are removed in 6.1. Every other resource moves outright.
diff --git a/.changeset/admin-api-state-code.md b/.changeset/admin-api-state-code.md
deleted file mode 100644
index f566ace0aa..0000000000
--- a/.changeset/admin-api-state-code.md
+++ /dev/null
@@ -1,8 +0,0 @@
----
-'@spree/admin-sdk': major
-'@spree/sdk': major
----
-
-Rename `state_abbr` to `state_code` across the v3 API. Addresses, stock locations and delivery zone members now serialize `state_code`, and write endpoints accept it — the canonical name matches the tax jurisdiction fields (`country_iso`/`state_code`).
-
-Addresses keep `state_abbr` as a deprecated read field and an accepted write name for one release, so existing storefronts keep working; it is removed in 6.1. Every other resource moves outright.
diff --git a/CLAUDE.md b/CLAUDE.md
index 48fb4882f8..380940eef7 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -27,10 +27,10 @@ Active plans (6.0 target, work pending):
- `6.0-returns-exchanges-claims.md` — First-class Return, Exchange, Claim models replacing ReturnAuthorization/Reimbursement chain. **COMPLETE (2026-08-05):** all three entities (+ permanent `ReturnLineItem`/`ExchangeLineItem`/`ClaimLineItem` line items), `Spree::HasStatus`, all fifteen workflows (each with a leading `validate` hook), `Refund#originator`, admin + store v3 APIs (transitions as PATCH member actions; no destroy — cancel instead), dashboard pages. Legacy chain **removed**: ReturnAuthorization/CustomerReturn/Reimbursement/ReimbursementType/legacy ReturnItem + eligibility validators + ReturnsCalculator classes all deleted, but their **tables deliberately survive to 6.1** as the data migration's source and rollback path. `spree:upgrade:migrate_returns` (`Spree::ReturnsMigrator`, defined in the rake file like its sibling upgrade tasks; anonymous-AR readers) is in the 5.6→6.0 manifest after the adjustments step; it needs no cursor because the preserved `number` is uniquely indexed on the new tables, so "what's left" is a `where.not(number: ...)` query and an interrupted run resumes for free. `ReturnAuthorizationReason`→`ReturnReason` (alias one release) + new `ClaimReason`; `Metafields` on all three. Capability replacements: `Spree::ReturnMailer#refunded_email` on `return.refunded` (replaces the reimbursement email), `Order#outstanding_balance` drops the reimbursement term (refunds already net out of `payment_total`), `Return#refunded_total` counts store credits too, `StoreCreditCategory.default_refund_category` (alias kept). **Reasons** ship admin-only CRUD (`/api/v3/admin/{return,claim,refund}_reasons`, `settings` scope) + a combined Settings → Reasons dashboard page + reason pickers on the create dialogs; `mutable` is never client-writable and the immutability guard lives on `Spree::NamedType` (`can_be_deleted?` + rename/destroy guards) because secret API keys authorize by scope and never consult CanCanCan. **No state machines (2026-08-02):** plain `status` string + inclusion validation; all fifteen transitions are workflows (`Returns::Receive`, `Exchanges::Fulfill`, `Claims::Resolve`, …) with `validate` hooks for return-eligibility policy and refunds as `external_step`. Nothing happens in a model or transition callback. Statuses live in a `class_attribute` via the core `Spree::HasStatus` concern (`has_status` + additive `add_status(value, after:)`, generating predicates and scopes) — extensible by design, additive only, and no transition graph (that would be a state machine again). **Return eligibility is a hook, not a policy engine (2026-08-03):** no window/restocking-fee/final-sale flag in core — a `validate` handler decides, enforcing for customers while letting staff override (it reads `created_by`), and region-varying policy reads `order.market`. Medusa/Saleor/Vendure ship no policy at all; Shopify's engine has no API. A `ReturnPolicy` model can arrive later behind the same hook.
- `6.0-platform-auth.md` — Drop Devise, own auth stack, User→Customer/Staff rename (RefreshToken shipped in 5.4)
- `6.0-store-context-and-first-run-setup.md` — Store context becomes credential-derived (design finalized 2026-08-13): publishable key selects the store on the Store API, Admin API honors `X-Spree-Store-Id` with membership checked against the *requested* store (header-less JWT → default store + deprecation, required 6.1), hostname-based store resolution retired (`FindDefault`'s `url:` is dead; never read `request.host` to pick a store). First-run setup replaces the `[email protected]`/`spree123` dummy seed: seed creates an admin only when `ADMIN_EMAIL`/`ADMIN_PASSWORD` are explicitly set; otherwise a one-time setup-token flow (dashboard `/setup` + unauthenticated `auth/setup` endpoints; `has_secure_token :setup_token` on Store — plaintext like invitation tokens, printed by installer, `spree:setup:token` reprints, cleared on completion — required in EVERY environment; `Spree::Stores::DashboardUrl` is the single resolver for the dashboard origin — used by the setup link, invitation emails and the SSO callback — resolving `dashboard_url` pref/`SPREE_DASHBOARD_URL` → deprecated `admin_url` → this app's own `/dashboard` mount when `spree_dashboard` serves a build → dev Vite → store URL; never a hardcoded port, and the CLI rebuilds the link host-side since the seed runs before any dashboard is up). **App configuration reads ENV:** `RuntimeConfiguration.preference` accepts `env:` (precedence: explicit value → env var → coded default), so deployment settings are configurable without touching Ruby; `dashboard_url` is env-backed via `SPREE_DASHBOARD_URL` and `admin_url` is deprecated in its favour. Applies to `Spree::Config` only — per-store behavior belongs in Store preferences. The setup flow creates the first admin and adopts/renames the seeded store; no general store CRUD in the OSS Admin API. **Constraints now:** never assume `current_store == Store.default` in Admin API code; store-touching cache keys include the store id by construction (enforced by the cache-key audit spec in core — global data needs a reviewed allowlist entry); new scripts pass `ADMIN_EMAIL`/`ADMIN_PASSWORD` explicitly. **Isolation tripwires (2026-08-13):** `Spree::StoreScopeGuard` wraps every v3 API request in dev/test and flags store-less secondary-key lookups and unscoped scans on store-owned tables (schema-derived set; id/FK filters and `SELECT 1 AS one` are exempt as loads-from-scoped-rows and uniqueness validations — exemption is NOT proof of scoping, request-derived ids still need `current_store` fetching; `log` default, `raise` in this repo's API suite, `SPREE_STORE_SCOPE_GUARD` to change) — wrap deliberately global lookups in `Spree::StoreScopeGuard.skip { }`. A store-owned model with an unscoped `acts_as_list` also fails the core suite (positions bleed across stores).
-- `6.0-tax-provider.md` — Per-Market TaxProvider (market selects the provider, providers stateless/argless; global config class stays as fallback), replaces TaxRate.adjust + Calculator; reference provider: Avalara (decisions.md 2026-07-30). **Shipped to 6-0-dev (core-rewrite waves):** `Spree::TaxProvider::Base`/`Internal` as the sole TaxLine write path, called from `Carts::RecalculateTotals` behind the `money_frozen?` freeze. **Contract refined 2026-08-05 after the spree/spree#14056 review (decisions.md):** TaxLine gains `taxability_reason` + jurisdiction snapshot (e-invoice category/exemption codes derived at invoicing time, never stored); new `Spree::TaxIdentifier` model (customer/cart/order dual-FK, frozen order snapshot; validation via the kind-keyed `Spree.tax_id_validators` registry + async job on the geocoding precedent — NOT a provider method, and no registry client in core); exemptions = typed `estimate` input via `tax_resolve_exemptions_service` (boolean `exempt?` removed, no flags anywhere); explicit `tax_date:`; `refund(order, return_items, tax_date:)`; capability declarations (Internal declares no US local tax / no reverse charge / no one-stop-shop thresholds; `estimate` keeps its no-op return — a structured result + indeterminacy channel deferred as safely additive). **Phases 3-5 in development:** the enriched contract, `Spree::TaxIdentifier` + validator registry, exemption value objects, per-Market selection with commit/void/refund as external steps, and the Zone decoupling (rates carry `country_iso`/`state_code` — codes, not FKs, since Country/State are being dropped; `spree_tax_rates.zone_id` stays through 6.0 as the conversion source). **Phases 3-5 + the Zone decoupling shipped to `feature/v-3526` (PR #14410).** **Phase 7 shipped to `feature/v-3526` (2026-08-12):** the minimal Company tree pulled forward out of the B2B plan — Company → CompanyLocation → CompanyContact, `company_location_id` on both carts and orders, `company_id` as a fourth TaxIdentifier owner, `Spree::TaxExemptionCertificate` hanging off Company scoped by `country_iso`/`state_code`, and the `ResolveExemptions` body; **no `tax_exempt` boolean anywhere** (supersedes the B2B plan's sketches), and Catalog/pricing/visibility stay 6.1. A buyer's company resolves only within the sale's own store, since customers are global. Pending after that: Phase 6 `spree_tax_avalara`, **Phase 8 cross-border pricing with tax-inclusive prices** (2026-08-11 live pass: `Pricing::Context.from_order` never carried the cart's market so market-scoped price lists were unreachable from a cart; `recalculate_for_address_change!` called the non-persisting `update_price`; restatement was applied even to prices set for the destination — the rule is now derive net-fixed unless the winning price list carries a `geographic?` rule, Shopify's model), Phase 9 6.1 cleanup (drop `zone_id`, `null: false` on the tax `store_id`s, decide `Market#tax_inclusive`). Still open: delivery-rate tax display bypasses the provider
+- `6.0-tax-provider.md` — Per-Market TaxProvider (market selects the provider, providers stateless/argless; global config class stays as fallback), replaces TaxRate.adjust + Calculator; reference provider: Avalara (decisions.md 2026-07-30). **Shipped to 6-0-dev (core-rewrite waves):** `Spree::TaxProvider::Base`/`Internal` as the sole TaxLine write path, called from `Carts::RecalculateTotals` behind the `money_frozen?` freeze. **Contract refined 2026-08-05 after the spree/spree#14056 review (decisions.md):** TaxLine gains `taxability_reason` + jurisdiction snapshot (e-invoice category/exemption codes derived at invoicing time, never stored); new `Spree::TaxIdentifier` model (customer/cart/order dual-FK, frozen order snapshot; validation via the kind-keyed `Spree.tax_id_validators` registry + async job on the geocoding precedent — NOT a provider method, and no registry client in core); exemptions = typed `estimate` input via `tax_resolve_exemptions_service` (boolean `exempt?` removed, no flags anywhere); explicit `tax_date:`; `refund(order, return_items, tax_date:)`; capability declarations (Internal declares no US local tax / no reverse charge / no one-stop-shop thresholds; `estimate` keeps its no-op return — a structured result + indeterminacy channel deferred as safely additive). **Phases 3-5 in development:** the enriched contract, `Spree::TaxIdentifier` + validator registry, exemption value objects, per-Market selection with commit/void/refund as external steps, and the Zone decoupling (rates carry `country_code`/`state_code` — codes, not FKs, since Country/State are being dropped; `spree_tax_rates.zone_id` stays through 6.0 as the conversion source). **Phases 3-5 + the Zone decoupling shipped to `feature/v-3526` (PR #14410).** **Phase 7 shipped to `feature/v-3526` (2026-08-12):** the minimal Company tree pulled forward out of the B2B plan — Company → CompanyLocation → CompanyContact, `company_location_id` on both carts and orders, `company_id` as a fourth TaxIdentifier owner, `Spree::TaxExemptionCertificate` hanging off Company scoped by `country_code`/`state_code`, and the `ResolveExemptions` body; **no `tax_exempt` boolean anywhere** (supersedes the B2B plan's sketches), and Catalog/pricing/visibility stay 6.1. A buyer's company resolves only within the sale's own store, since customers are global. Pending after that: Phase 6 `spree_tax_avalara`, **Phase 8 cross-border pricing with tax-inclusive prices** (2026-08-11 live pass: `Pricing::Context.from_order` never carried the cart's market so market-scoped price lists were unreachable from a cart; `recalculate_for_address_change!` called the non-persisting `update_price`; restatement was applied even to prices set for the destination — the rule is now derive net-fixed unless the winning price list carries a `geographic?` rule, Shopify's model), Phase 9 6.1 cleanup (drop `zone_id`, `null: false` on the tax `store_id`s, decide `Market#tax_inclusive`). Still open: delivery-rate tax display bypasses the provider
- `6.0-delivery-rate-provider.md` — Per-DeliveryMethod DeliveryRateProvider wrapping Stock::Estimator (calculators stay — 2026-07-27 reversal), `store_id` on ShippingMethod; monorepo ships one reference multi-carrier provider (**EasyPost** — decisions.md 2026-08-06 reversal: BYOCA fit for larger merchants + only maintained official Ruby SDK; Shippo's ruby gem dead since 2020); method rows stay regional (no cross-market method entity). **Dynamic carrier rates (2026-08-09):** a carrier method is the carrier connection — `estimates(package)` returns one Estimate per service, each becoming its own named DeliveryRate (unique (fulfillment, method) rate index dropped; `DeliveryRate#name` falls back to the method name); `Spree::DeliveryMethodService` rows narrow/rename/mark-up services (no rows = all, method-level markup columns as default); selection + EasyPost label buy key off the selected rate's carrier/service; seeds/sample data reshaped Shopify-style (Domestic + International zones with basic methods)
-- `6.0-delivery-zones.md` — Zone → DeliveryZone with postal-code-range/prefix members (country-scoped); owns the full ~183-reference Zone consumer inventory; `Spree::Zone` dropped entirely by end of 6.0 (2026-07-27 — 6.0 is the breaking-change window) Member FKs convert to `country_iso`/`state_code` strings per `6.0-drop-country-state-models.md` (2026-08-07)
-- `6.0-drop-country-state-models.md` — Delete the `Spree::Country`/`Spree::State` AR models in 6.0 (the tables and legacy FK columns survive to 6.1 as the upgrade task's source data); constants survive as `countries`-gem-backed value objects (carmen removed), consumers store `country_iso` + `state_code` strings (always paired — subdivision codes aren't globally unique), Address validation semantics preserved (`STATES_REQUIRED` constants become runtime source of truth). No `id` was ever exposed, so the only v3 change is the `state_abbr`→`state_code` rename — `Spree::Address` alone keeps `state_abbr` as a deprecated read/write bridge until 6.1. Amends tax-provider Phase 5 (TaxRate columns born as ISO strings, not FKs) and delivery-zone members. **Shipped (2026-08-14):** value objects live, carmen + country/state seeds + row-creating fallbacks deleted; `Spree::IsoData` curated registry + drift-guard spec, ISO columns on addresses/delivery-zone-members/market-countries/stock-locations/stores with `spree:upgrade:migrate_country_state_isos` in the 5.6→6.0 manifest, every consumer matching on codes, admin FK params closed, country endpoints uncached, factories built from real ISO data. `Spree::Zone`/`ZoneMember` are migration-only shells (no `zoneable` association; the data tasks resolve member ids against the legacy tables via SQL) and drop in 6.1 with the tables. **Constraint now:** no new `country_id`/`state_id` FKs or `belongs_to :country/:state` anywhere — a new model carrying geography declares `has_iso_geography` (`Spree::HasIsoGeography`, on `Spree::Base`; `state: false` for country-only tables), stores ISO strings and names the column `state_code` — never `state_abbr`; preference-based rules follow `Promotion::Rules::Country`
+- `6.0-delivery-zones.md` — Zone → DeliveryZone with postal-code-range/prefix members (country-scoped); owns the full ~183-reference Zone consumer inventory; `Spree::Zone` dropped entirely by end of 6.0 (2026-07-27 — 6.0 is the breaking-change window) Member FKs convert to `country_code`/`state_code` strings per `6.0-drop-country-state-models.md` (2026-08-07)
+- `6.0-drop-country-state-models.md` — Delete the `Spree::Country`/`Spree::State` AR models in 6.0 (the tables and legacy FK columns survive to 6.1 as the upgrade task's source data); constants survive as `countries`-gem-backed value objects (carmen removed), consumers store `country_code` + `state_code` strings (always paired — subdivision codes aren't globally unique), Address validation semantics preserved (`STATES_REQUIRED` constants become runtime source of truth). No `id` was ever exposed, so the only v3 changes are the `state_abbr`→`state_code` and `country_iso`→`country_code` renames (Market's list moves `country_isos`→`country_codes`) — `Spree::Address` alone keeps `state_abbr` and `country_iso` as deprecated read/write bridges until 6.1. Amends tax-provider Phase 5 (TaxRate columns born as ISO strings, not FKs) and delivery-zone members. **Shipped (2026-08-14):** value objects live, carmen + country/state seeds + row-creating fallbacks deleted; `Spree::IsoData` curated registry + drift-guard spec, ISO columns on addresses/delivery-zone-members/market-countries/stock-locations/stores with `spree:upgrade:migrate_country_state_codes` in the 5.6→6.0 manifest, every consumer matching on codes, admin FK params closed, country endpoints uncached, factories built from real ISO data. `Spree::Zone`/`ZoneMember` are migration-only shells (no `zoneable` association; the data tasks resolve member ids against the legacy tables via SQL) and drop in 6.1 with the tables. **Constraint now:** no new `country_id`/`state_id` FKs or `belongs_to :country/:state` anywhere — a new model carrying geography declares `has_iso_geography` (`Spree::HasIsoGeography`, on `Spree::Base`; `state: false` for country-only tables) and stores ISO strings in columns named `country_code` + `state_code` — never `country_iso` or `state_abbr`; preference-based rules follow `Promotion::Rules::Country`
- `6.0-integrations-admin.md` — **Implemented (2026-08-06).** `Spree::Integration` as the single credential surface for all provider seams (delivery rates/tax/fulfillment/pickup points): explicit `Spree.integrations` registry, Admin API v3 CRUD + types discovery (reusing `PreferenceSchema`/`Masking` — secrets are `:password` preferences), dashboard `/settings/integrations` gallery grouped by `integration_group`. Verify-before-activate (`active: true` runs `can_connect?`, 422 on failure), ephemeral connection status. Constraints now: provider gems ship an Integration subclass (no env-var credential contracts for per-store providers); no per-provider credential UIs — pickers deep-link to the integrations page.
- `6.0-rich-text-descriptions.md` — Drop ActionText **entirely** at 6.0 (incl. CustomFields::RichText values + Order/User internal notes; gem dependency removed), store sanitized HTML in text columns, serve `field` + `field_html`, **write via `field_html`** (read/write symmetry). description_html serializer shipped 5.4; sanitizer shipped in **5.6.2** with a permissive-but-safe configurable allowlist + `sanitize_rich_text` step in the 5.5→5.6 upgrade manifest (decisions.md 2026-07-27/28), tightened to the Tiptap set at 6.0
- `6.0-inventory-operations.md` — StockTransfer lifecycle (draft → ready_to_ship → in_transit → received with partial receive), new `Spree::PurchaseOrder` + `Spree::Supplier` (renamed from Vendor — `Spree::Vendor` is the marketplace seller, see decisions.md 2026-07-14) replacing today's "external receive" hack, variant + stock-location stock history panels. Consumes the typed-movement primitives from `6.0-typed-stock-movements.md`.
diff --git a/docs/api-reference/admin.yaml b/docs/api-reference/admin.yaml
index 379f4179c3..f4ade8ad1b 100644
--- a/docs/api-reference/admin.yaml
+++ b/docs/api-reference/admin.yaml
@@ -92,16 +92,16 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6Ijg0NmI1ZDIwLTM4MGMtNGJmYy04ZmEwLWY0Y2U2YmJjMDdmNiIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2NzcwOTM5fQ.ZypwIXSGsqPHvH7rrLfve3gC8yNqS_veozPa46V9kK4
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImE4MTdiZTNhLTFlNDQtNDZjNC05MzE4LTFiODUxNTdjMDQxNCIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2Nzc3NDA4fQ.ym8H4TbzxzTi87OgBymqLx2o9pNBCorYqa2pgU0E5Qk
user:
id: adm_UkLWZg9DAJ
- first_name: Maragret
- last_name: Sporer
- full_name: Maragret Sporer
+ first_name: Jenee
+ last_name: Renner
+ full_name: Jenee Renner
selected_locale:
- created_at: '2026-08-15T05:10:39.374Z'
- updated_at: '2026-08-15T05:10:39.374Z'
+ created_at: '2026-08-15T06:58:28.798Z'
+ updated_at: '2026-08-15T06:58:28.798Z'
avatar_url:
roles:
- id: role_UkLWZg9DAJ
@@ -204,16 +204,16 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImY1NGY4MDU3LTQ5OTctNGJmMi04MWFjLTlhY2QxNDExODgwMiIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2NzcwOTM5fQ.kJquR9ioocgA7seA8Y0DGRJTViJMV7Dlnh266M9Hjb4
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6IjE2NWFmNDU1LTk3MTMtNGU5MS1hYTRmLTU4ODc1MjU0NTU2NCIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2Nzc3NDA4fQ.A-VUXBvckC85sdgDK9152lYwNQEx9Jipvez21FNIdeU
user:
id: adm_UkLWZg9DAJ
- first_name: Manuela
- last_name: Willms
- full_name: Manuela Willms
+ first_name: Sybil
+ last_name: Reinger
+ full_name: Sybil Reinger
selected_locale:
- created_at: '2026-08-15T05:10:39.457Z'
- updated_at: '2026-08-15T05:10:39.457Z'
+ created_at: '2026-08-15T06:58:28.854Z'
+ updated_at: '2026-08-15T06:58:28.854Z'
avatar_url:
roles:
- id: role_UkLWZg9DAJ
@@ -315,13 +315,13 @@ paths:
example:
user:
id: adm_UkLWZg9DAJ
- first_name: Clement
- last_name: Terry
- full_name: Clement Terry
+ first_name: Michal
+ last_name: Welch
+ full_name: Michal Welch
selected_locale:
- created_at: '2026-08-15T05:10:45.344Z'
- updated_at: '2026-08-15T05:10:45.344Z'
+ created_at: '2026-08-15T06:58:34.503Z'
+ updated_at: '2026-08-15T06:58:34.503Z'
avatar_url:
roles:
- id: role_UkLWZg9DAJ
@@ -432,13 +432,13 @@ paths:
example:
user:
id: adm_UkLWZg9DAJ
- first_name: Marcel
- last_name: Schmitt
- full_name: Marcel Schmitt
+ first_name: Chiquita
+ last_name: Tremblay
+ full_name: Chiquita Tremblay
selected_locale: de
- created_at: '2026-08-15T05:10:45.378Z'
- updated_at: '2026-08-15T05:10:45.388Z'
+ created_at: '2026-08-15T06:58:34.544Z'
+ updated_at: '2026-08-15T06:58:34.554Z'
avatar_url:
roles:
- id: role_UkLWZg9DAJ
@@ -626,16 +626,16 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImJlMmQ2ZWQzLTQyNGItNGY1My1hZmNmLTI0MjgxNmZkYzhmMCIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2Nzc0MjU0fQ.xGTT407ROshm4W_LtkunGBl0kIeyvhBmgKwPa3lc5M0
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImI2MDQzZWYzLWZhMWYtNGY2ZS04N2RkLWI5ZGE4NzAxNDc3NCIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2NzgwNzIxfQ.DnYDXufA2mVgKSKCecvmjFuKeRr3WRkASNlVBeWiHog
user:
id: adm_UkLWZg9DAJ
- first_name: Anjelica
- last_name: Nolan
- full_name: Anjelica Nolan
+ first_name: Kiersten
+ last_name: Jenkins
+ full_name: Kiersten Jenkins
selected_locale:
- created_at: '2026-08-15T05:10:54.546Z'
- updated_at: '2026-08-15T05:10:54.558Z'
+ created_at: '2026-08-15T06:58:41.965Z'
+ updated_at: '2026-08-15T06:58:41.976Z'
avatar_url:
roles:
- id: role_UkLWZg9DAJ
@@ -704,7 +704,7 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6IjQyZDVhYTY1LTg3YTgtNGYxMC1hNjUwLWFkOGU5MGMzODQ2MiIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2NzcwOTYwfQ.5B1uR5cEk_uAZa6-FS_nR0j6FEOblTIfUKuvBo5yUUM
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImQ3MDFhYjE0LWVhMWItNDVmNS1hNzM2LWYyOTliNmMwMmYwOCIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2Nzc3NDI3fQ.MRVqEZ16yqboZtiTuixDV1jWzwAOurho8mUapCEeptA
user:
id: adm_UkLWZg9DAJ
@@ -712,8 +712,8 @@ paths:
last_name: Owner
full_name: Olivia Owner
selected_locale:
- created_at: '2026-08-15T05:11:00.515Z'
- updated_at: '2026-08-15T05:11:00.515Z'
+ created_at: '2026-08-15T06:58:47.089Z'
+ updated_at: '2026-08-15T06:58:47.089Z'
avatar_url:
roles:
- id: role_UkLWZg9DAJ
@@ -766,7 +766,7 @@ paths:
type: string
description: ISO currency code for the store.
example: USD
- country_iso:
+ country_code:
type: string
description: ISO 3166-1 alpha-2 country code for the store.
example: US
@@ -853,8 +853,8 @@ paths:
data:
- id: ao_UkLWZg9DAJ
origin: https://shop.example.com
- created_at: '2026-08-15T05:10:38.935Z'
- updated_at: '2026-08-15T05:10:38.935Z'
+ created_at: '2026-08-15T06:58:28.390Z'
+ updated_at: '2026-08-15T06:58:28.390Z'
meta:
page: 1
limit: 25
@@ -938,8 +938,8 @@ paths:
example:
id: ao_gbHJdmfrXB
origin: https://admin.example.com
- created_at: '2026-08-15T05:10:39.003Z'
- updated_at: '2026-08-15T05:10:39.003Z'
+ created_at: '2026-08-15T06:58:28.452Z'
+ updated_at: '2026-08-15T06:58:28.452Z'
schema:
"$ref": "#/components/schemas/AllowedOrigin"
'422':
@@ -1026,8 +1026,8 @@ paths:
example:
id: ao_UkLWZg9DAJ
origin: https://shop.example.com
- created_at: '2026-08-15T05:10:39.042Z'
- updated_at: '2026-08-15T05:10:39.042Z'
+ created_at: '2026-08-15T06:58:28.484Z'
+ updated_at: '2026-08-15T06:58:28.484Z'
schema:
"$ref": "#/components/schemas/AllowedOrigin"
'404':
@@ -1088,8 +1088,8 @@ paths:
example:
id: ao_UkLWZg9DAJ
origin: https://www.example.com
- created_at: '2026-08-15T05:10:39.127Z'
- updated_at: '2026-08-15T05:10:39.142Z'
+ created_at: '2026-08-15T06:58:28.527Z'
+ updated_at: '2026-08-15T06:58:28.542Z'
schema:
"$ref": "#/components/schemas/AllowedOrigin"
'422':
@@ -1209,34 +1209,34 @@ paths:
key_type: publishable
token_prefix:
scopes: []
- created_at: '2026-08-15T05:10:39.195Z'
- updated_at: '2026-08-15T05:10:39.195Z'
+ created_at: '2026-08-15T06:58:28.618Z'
+ updated_at: '2026-08-15T06:58:28.618Z'
revoked_at:
last_used_at:
channel_id:
- plaintext_token: pk_27oGXhqDmpA2CS7GkHudAvm4
+ plaintext_token: pk_z35ip2EGXiYeGLYroyvAJVKH
created_by_email:
- id: key_gbHJdmfrXB
name: Backend integration
key_type: secret
- token_prefix: sk_vQr4ywGfV
+ token_prefix: sk_Ef9ZLtumw
scopes:
- write_all
- created_at: '2026-08-15T05:10:39.196Z'
- updated_at: '2026-08-15T05:10:39.196Z'
+ created_at: '2026-08-15T06:58:28.620Z'
+ updated_at: '2026-08-15T06:58:28.620Z'
revoked_at:
last_used_at:
channel_id:
plaintext_token:
created_by_email:
- id: key_EfhxLZ9ck8
- name: voluptatum
+ name: eaque
key_type: secret
- token_prefix: sk_VTBcd6dv3
+ token_prefix: sk_P443avskw
scopes:
- write_all
- created_at: '2026-08-15T05:10:39.197Z'
- updated_at: '2026-08-15T05:10:39.197Z'
+ created_at: '2026-08-15T06:58:28.621Z'
+ updated_at: '2026-08-15T06:58:28.621Z'
revoked_at:
last_used_at:
channel_id:
@@ -1303,16 +1303,16 @@ paths:
id: key_VqXmZF31wY
name: CI key
key_type: secret
- token_prefix: sk_qqcMRYED9
+ token_prefix: sk_77SgLPyNB
scopes:
- read_orders
- created_at: '2026-08-15T05:10:39.234Z'
- updated_at: '2026-08-15T05:10:39.234Z'
+ created_at: '2026-08-15T06:58:28.666Z'
+ updated_at: '2026-08-15T06:58:28.666Z'
revoked_at:
last_used_at:
channel_id:
- plaintext_token: sk_qqcMRYED9QnBaAQr6AMvun8U
- created_by_email: [email protected]
+ plaintext_token: sk_77SgLPyNBSN6UYKev19bFfHb
+ created_by_email: [email protected]
'422':
description: validation error
content:
@@ -1401,12 +1401,12 @@ paths:
key_type: publishable
token_prefix:
scopes: []
- created_at: '2026-08-15T05:10:39.268Z'
- updated_at: '2026-08-15T05:10:39.268Z'
+ created_at: '2026-08-15T06:58:28.694Z'
+ updated_at: '2026-08-15T06:58:28.694Z'
revoked_at:
last_used_at:
channel_id:
- plaintext_token: pk_tMzFxTQq7hn9WrvPiqSX1MrJ
+ plaintext_token: pk_3kYKULFavxFpsRvRjEAx32cn
created_by_email:
patch:
summary: Update an API key
@@ -1460,11 +1460,11 @@ paths:
id: key_gbHJdmfrXB
name: Backend integration (renamed)
key_type: secret
- token_prefix: sk_pJ2wt6XAM
+ token_prefix: sk_nmHXXafaP
scopes:
- write_all
- created_at: '2026-08-15T05:10:39.297Z'
- updated_at: '2026-08-15T05:10:39.316Z'
+ created_at: '2026-08-15T06:58:28.714Z'
+ updated_at: '2026-08-15T06:58:28.735Z'
revoked_at:
last_used_at:
channel_id:
@@ -1561,13 +1561,13 @@ paths:
application/json:
example:
id: key_EfhxLZ9ck8
- name: harum
+ name: veniam
key_type: secret
- token_prefix: sk_DqbZPhD2v
+ token_prefix: sk_n4WZVFRwi
scopes:
- write_all
- created_at: '2026-08-15T05:10:39.345Z'
- updated_at: '2026-08-15T05:10:39.345Z'
+ created_at: '2026-08-15T06:58:28.764Z'
+ updated_at: '2026-08-15T06:58:28.764Z'
revoked_at:
last_used_at:
channel_id:
@@ -1625,12 +1625,12 @@ paths:
id: key_gbHJdmfrXB
name: Backend integration
key_type: secret
- token_prefix: sk_nhrjB8mju
+ token_prefix: sk_k9RnDkhzA
scopes:
- write_all
- created_at: '2026-08-15T05:10:39.354Z'
- updated_at: '2026-08-15T05:10:39.367Z'
- revoked_at: '2026-08-15T05:10:39.366Z'
+ created_at: '2026-08-15T06:58:28.774Z'
+ updated_at: '2026-08-15T06:58:28.786Z'
+ revoked_at: '2026-08-15T06:58:28.786Z'
last_used_at:
channel_id:
plaintext_token:
@@ -1707,8 +1707,8 @@ paths:
lft: 1
rgt: 2
products_count: 0
- created_at: '2026-08-15T05:10:39.535Z'
- updated_at: '2026-08-15T05:10:39.535Z'
+ created_at: '2026-08-15T06:58:28.922Z'
+ updated_at: '2026-08-15T06:58:28.922Z'
meta:
page: 1
limit: 25
@@ -1782,8 +1782,8 @@ paths:
lft: 2
rgt: 3
products_count: 0
- created_at: '2026-08-15T05:10:39.621Z'
- updated_at: '2026-08-15T05:10:39.628Z'
+ created_at: '2026-08-15T06:58:28.969Z'
+ updated_at: '2026-08-15T06:58:28.978Z'
schema:
"$ref": "#/components/schemas/Category"
'422':
@@ -1889,8 +1889,8 @@ paths:
lft: 1
rgt: 2
products_count: 0
- created_at: '2026-08-15T05:10:39.671Z'
- updated_at: '2026-08-15T05:10:39.671Z'
+ created_at: '2026-08-15T06:58:29.020Z'
+ updated_at: '2026-08-15T06:58:29.020Z'
schema:
"$ref": "#/components/schemas/Category"
'404':
@@ -1960,8 +1960,8 @@ paths:
lft: 1
rgt: 2
products_count: 0
- created_at: '2026-08-15T05:10:39.756Z'
- updated_at: '2026-08-15T05:10:39.783Z'
+ created_at: '2026-08-15T06:58:29.103Z'
+ updated_at: '2026-08-15T06:58:29.128Z'
schema:
"$ref": "#/components/schemas/Category"
requestBody:
@@ -2076,8 +2076,8 @@ paths:
lft: 2
rgt: 3
products_count: 0
- created_at: '2026-08-15T05:10:39.830Z'
- updated_at: '2026-08-15T05:10:39.852Z'
+ created_at: '2026-08-15T06:58:29.175Z'
+ updated_at: '2026-08-15T06:58:29.196Z'
schema:
"$ref": "#/components/schemas/Category"
requestBody:
@@ -2189,8 +2189,8 @@ paths:
application/json:
example:
id: prod_UkLWZg9DAJ
- name: Product 16797
- slug: product-16797
+ name: Product 1380
+ slug: product-1380
meta_title:
meta_description:
meta_keywords:
@@ -2202,17 +2202,14 @@ paths:
in_stock: false
backorderable: true
available: true
- description: Ad totam repellat voluptas molestiae numquam dolor fugiat.
- Commodi harum libero cum doloremque nulla beatae eos. Aut eius placeat
- qui consequuntur rem tempore autem facere. Consectetur fuga incidunt
- praesentium unde. Sunt similique nihil corrupti incidunt soluta
- possimus totam itaque. Dignissimos quia iste consectetur ratione
- eius nostrum enim. Reprehenderit ratione a consequatur quas ex commodi
- excepturi autem. Unde harum nam amet error est aliquid. Consequuntur
- aspernatur doloribus tempora dolore beatae placeat.
- description_html: |-
- Ad totam repellat voluptas molestiae numquam dolor fugiat. Commodi harum libero cum doloremque nulla beatae eos. Aut eius placeat qui consequuntur rem tempore autem facere. Consectetur fuga incidunt praesentium unde. Sunt similique nihil corrupti incidunt soluta possimus totam itaque.
- Dignissimos quia iste consectetur ratione eius nostrum enim. Reprehenderit ratione a consequatur quas ex commodi excepturi autem. Unde harum nam amet error est aliquid. Consequuntur aspernatur doloribus tempora dolore beatae placeat.
+ description: Ipsam eaque exercitationem veniam cumque minima. Ex tenetur
+ ipsam recusandae minus. Excepturi adipisci sed nulla sapiente quo
+ libero. Enim quo tempore necessitatibus voluptate facere labore
+ beatae modi. Cumque voluptatum occaecati illo fugiat ea exercitationem.
+ description_html: Ipsam eaque exercitationem veniam cumque minima.
+ Ex tenetur ipsam recusandae minus. Excepturi adipisci sed nulla
+ sapiente quo libero. Enim quo tempore necessitatibus voluptate facere
+ labore beatae modi. Cumque voluptatum occaecati illo fugiat ea exercitationem.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -2227,14 +2224,14 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-08-15T05:10:39.996Z'
- updated_at: '2026-08-15T05:10:39.996Z'
+ created_at: '2026-08-15T06:58:29.324Z'
+ updated_at: '2026-08-15T06:58:29.324Z'
original_price:
status: active
metadata: {}
deleted_at:
- created_at: '2026-08-15T05:10:39.967Z'
- updated_at: '2026-08-15T05:10:40.013Z'
+ created_at: '2026-08-15T06:58:29.303Z'
+ updated_at: '2026-08-15T06:58:29.337Z'
delivery_profile_id: fp_UkLWZg9DAJ
product_type_id:
tax_category_id: taxcat_UkLWZg9DAJ
@@ -2405,8 +2402,8 @@ paths:
preferred_order_routing_strategy:
preferred_storefront_access:
preferred_guest_checkout:
- created_at: '2026-08-15T05:10:38.589Z'
- updated_at: '2026-08-15T05:10:38.589Z'
+ created_at: '2026-08-15T06:58:28.082Z'
+ updated_at: '2026-08-15T06:58:28.082Z'
stock_location_ids: []
- id: ch_gbHJdmfrXB
name: Wholesale
@@ -2418,8 +2415,8 @@ paths:
preferred_order_routing_strategy:
preferred_storefront_access:
preferred_guest_checkout:
- created_at: '2026-08-15T05:10:40.228Z'
- updated_at: '2026-08-15T05:10:40.228Z'
+ created_at: '2026-08-15T06:58:29.534Z'
+ updated_at: '2026-08-15T06:58:29.534Z'
stock_location_ids: []
meta:
page: 1
@@ -2505,8 +2502,8 @@ paths:
preferred_order_routing_strategy:
preferred_storefront_access:
preferred_guest_checkout:
- created_at: '2026-08-15T05:10:40.294Z'
- updated_at: '2026-08-15T05:10:40.294Z'
+ created_at: '2026-08-15T06:58:29.596Z'
+ updated_at: '2026-08-15T06:58:29.596Z'
stock_location_ids: []
requestBody:
content:
@@ -2605,8 +2602,8 @@ paths:
preferred_order_routing_strategy:
preferred_storefront_access:
preferred_guest_checkout:
- created_at: '2026-08-15T05:10:40.310Z'
- updated_at: '2026-08-15T05:10:40.310Z'
+ created_at: '2026-08-15T06:58:29.611Z'
+ updated_at: '2026-08-15T06:58:29.611Z'
stock_location_ids: []
patch:
summary: Update a channel
@@ -2661,8 +2658,8 @@ paths:
preferred_order_routing_strategy:
preferred_storefront_access: login_required
preferred_guest_checkout: false
- created_at: '2026-08-15T05:10:40.338Z'
- updated_at: '2026-08-15T05:10:40.361Z'
+ created_at: '2026-08-15T06:58:29.640Z'
+ updated_at: '2026-08-15T06:58:29.664Z'
stock_location_ids: []
requestBody:
content:
@@ -2945,8 +2942,8 @@ paths:
- id: orule_UkLWZg9DAJ
position: 1
active: true
- created_at: '2026-08-15T05:10:38.594Z'
- updated_at: '2026-08-15T05:10:38.594Z'
+ created_at: '2026-08-15T06:58:28.087Z'
+ updated_at: '2026-08-15T06:58:28.087Z'
type: preferred_location
channel_id: ch_UkLWZg9DAJ
preferences: {}
@@ -2957,8 +2954,8 @@ paths:
- id: orule_gbHJdmfrXB
position: 2
active: true
- created_at: '2026-08-15T05:10:38.597Z'
- updated_at: '2026-08-15T05:10:38.597Z'
+ created_at: '2026-08-15T06:58:28.090Z'
+ updated_at: '2026-08-15T06:58:28.090Z'
type: minimize_splits
channel_id: ch_UkLWZg9DAJ
preferences: {}
@@ -2969,8 +2966,8 @@ paths:
- id: orule_EfhxLZ9ck8
position: 3
active: true
- created_at: '2026-08-15T05:10:38.600Z'
- updated_at: '2026-08-15T05:10:38.600Z'
+ created_at: '2026-08-15T06:58:28.093Z'
+ updated_at: '2026-08-15T06:58:28.093Z'
type: default_location
channel_id: ch_UkLWZg9DAJ
preferences: {}
@@ -3035,8 +3032,8 @@ paths:
id: orule_VqXmZF31wY
position: 3
active: true
- created_at: '2026-08-15T05:10:46.621Z'
- updated_at: '2026-08-15T05:10:46.621Z'
+ created_at: '2026-08-15T06:58:35.669Z'
+ updated_at: '2026-08-15T06:58:35.669Z'
type: default_location
channel_id: ch_UkLWZg9DAJ
preferences: {}
@@ -3131,8 +3128,8 @@ paths:
id: orule_UkLWZg9DAJ
position: 2
active: false
- created_at: '2026-08-15T05:10:38.594Z'
- updated_at: '2026-08-15T05:10:46.664Z'
+ created_at: '2026-08-15T06:58:28.087Z'
+ updated_at: '2026-08-15T06:58:35.719Z'
type: preferred_location
channel_id: ch_UkLWZg9DAJ
preferences: {}
@@ -3320,8 +3317,8 @@ paths:
searchable: false
sortable: false
filter_key: cf_specs_fabric
- created_at: '2026-08-15T05:10:41.957Z'
- updated_at: '2026-08-15T05:10:41.957Z'
+ created_at: '2026-08-15T06:58:31.186Z'
+ updated_at: '2026-08-15T06:58:31.186Z'
- id: cfdef_gbHJdmfrXB
namespace: custom
key: order_notes
@@ -3332,8 +3329,8 @@ paths:
searchable: false
sortable: false
filter_key: cf_custom_order_notes
- created_at: '2026-08-15T05:10:41.964Z'
- updated_at: '2026-08-15T05:10:41.964Z'
+ created_at: '2026-08-15T06:58:31.187Z'
+ updated_at: '2026-08-15T06:58:31.187Z'
meta:
page: 1
limit: 25
@@ -3402,8 +3399,8 @@ paths:
searchable: false
sortable: false
filter_key: cf_specs_origin
- created_at: '2026-08-15T05:10:42.012Z'
- updated_at: '2026-08-15T05:10:42.012Z'
+ created_at: '2026-08-15T06:58:31.221Z'
+ updated_at: '2026-08-15T06:58:31.221Z'
requestBody:
content:
application/json:
@@ -3511,8 +3508,8 @@ paths:
searchable: false
sortable: false
filter_key: cf_specs_fabric
- created_at: '2026-08-15T05:10:42.019Z'
- updated_at: '2026-08-15T05:10:42.019Z'
+ created_at: '2026-08-15T06:58:31.227Z'
+ updated_at: '2026-08-15T06:58:31.227Z'
patch:
summary: Update a custom field definition
tags:
@@ -3572,8 +3569,8 @@ paths:
searchable: false
sortable: false
filter_key: cf_specs_fabric
- created_at: '2026-08-15T05:10:42.046Z'
- updated_at: '2026-08-15T05:10:42.063Z'
+ created_at: '2026-08-15T06:58:31.249Z'
+ updated_at: '2026-08-15T06:58:31.263Z'
requestBody:
content:
application/json:
@@ -3719,14 +3716,14 @@ paths:
name: VIPs
description: Top spenders
customers_count: 0
- created_at: '2026-08-15T05:10:42.093Z'
- updated_at: '2026-08-15T05:10:42.093Z'
+ created_at: '2026-08-15T06:58:31.312Z'
+ updated_at: '2026-08-15T06:58:31.312Z'
- id: cg_gbHJdmfrXB
name: Wholesale
description:
customers_count: 0
- created_at: '2026-08-15T05:10:42.094Z'
- updated_at: '2026-08-15T05:10:42.094Z'
+ created_at: '2026-08-15T06:58:31.313Z'
+ updated_at: '2026-08-15T06:58:31.313Z'
meta:
page: 1
limit: 25
@@ -3815,8 +3812,8 @@ paths:
name: Wholesale 2
description: B2B accounts
customers_count: 1
- created_at: '2026-08-15T05:10:42.153Z'
- updated_at: '2026-08-15T05:10:42.153Z'
+ created_at: '2026-08-15T06:58:31.379Z'
+ updated_at: '2026-08-15T06:58:31.379Z'
schema:
"$ref": "#/components/schemas/CustomerGroup"
'422':
@@ -3925,22 +3922,22 @@ paths:
name: VIPs
description: Top spenders
customers_count: 1
- created_at: '2026-08-15T05:10:42.213Z'
- updated_at: '2026-08-15T05:10:42.213Z'
+ created_at: '2026-08-15T06:58:31.437Z'
+ updated_at: '2026-08-15T06:58:31.437Z'
customers:
- id: cust_UkLWZg9DAJ
- first_name: Casie
- last_name: Littel
+ first_name: Danae
+ last_name: Johnson
phone:
accepts_email_marketing: false
- full_name: Casie Littel
+ full_name: Danae Johnson
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
failed_attempts: 0
metadata: {}
- created_at: '2026-08-15T05:10:42.217Z'
- updated_at: '2026-08-15T05:10:42.217Z'
+ created_at: '2026-08-15T06:58:31.440Z'
+ updated_at: '2026-08-15T06:58:31.440Z'
tags: []
internal_note:
internal_note_html:
@@ -4020,8 +4017,8 @@ paths:
name: VIP customers (Q1)
description: Top spenders
customers_count: 0
- created_at: '2026-08-15T05:10:42.280Z'
- updated_at: '2026-08-15T05:10:42.297Z'
+ created_at: '2026-08-15T06:58:31.495Z'
+ updated_at: '2026-08-15T06:58:31.510Z'
schema:
"$ref": "#/components/schemas/CustomerGroup"
'422':
@@ -4171,18 +4168,19 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
label:
metadata: {}
- created_at: '2026-08-15T05:10:42.362Z'
- updated_at: '2026-08-15T05:10:42.362Z'
+ created_at: '2026-08-15T06:58:31.581Z'
+ updated_at: '2026-08-15T06:58:31.581Z'
customer_id: cust_UkLWZg9DAJ
meta:
page: 1
@@ -4222,7 +4220,7 @@ paths:
address1: '350 Fifth Avenue',
city: 'New York',
postal_code: '10118',
- country_iso: 'US',
+ country_code: 'US',
state_code: 'NY',
phone: '+1 212 555 1234',
label: 'Office',
@@ -4231,7 +4229,7 @@ paths:
- lang: bash
label: Spree CLI
source: spree api post /customers/{customer_id}/addresses -d '{"first_name":"Jane","last_name":"Doe","address1":"350
- Fifth Avenue","city":"New York","postal_code":"10118","country_iso":"US","state_code":"NY","phone":"+1
+ Fifth Avenue","city":"New York","postal_code":"10118","country_code":"US","state_code":"NY","phone":"+1
212 555 1234","label":"Office","is_default_shipping":true}'
parameters:
- name: x-spree-api-key
@@ -4266,18 +4264,19 @@ paths:
phone: "+12125551234"
company:
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
label: Office
metadata: {}
- created_at: '2026-08-15T05:10:42.412Z'
- updated_at: '2026-08-15T05:10:42.412Z'
+ created_at: '2026-08-15T06:58:31.638Z'
+ updated_at: '2026-08-15T06:58:31.638Z'
customer_id: cust_UkLWZg9DAJ
requestBody:
content:
@@ -4297,7 +4296,7 @@ paths:
type: string
postal_code:
type: string
- country_iso:
+ country_code:
type: string
description: ISO-2 country code (e.g. US)
state_code:
@@ -4382,18 +4381,19 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
label:
metadata: {}
- created_at: '2026-08-15T05:10:42.428Z'
- updated_at: '2026-08-15T05:10:42.446Z'
+ created_at: '2026-08-15T06:58:31.656Z'
+ updated_at: '2026-08-15T06:58:31.678Z'
customer_id: cust_UkLWZg9DAJ
requestBody:
content:
@@ -4532,8 +4532,8 @@ paths:
customer_id: cust_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
metadata: {}
- created_at: '2026-08-15T05:10:42.518Z'
- updated_at: '2026-08-15T05:10:42.518Z'
+ created_at: '2026-08-15T06:58:31.745Z'
+ updated_at: '2026-08-15T06:58:31.745Z'
meta:
page: 1
limit: 25
@@ -4623,8 +4623,8 @@ paths:
customer_id: cust_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
metadata: {}
- created_at: '2026-08-15T05:10:42.565Z'
- updated_at: '2026-08-15T05:10:42.565Z'
+ created_at: '2026-08-15T06:58:31.779Z'
+ updated_at: '2026-08-15T06:58:31.779Z'
delete:
summary: Delete a customer credit card
tags:
@@ -4749,8 +4749,8 @@ paths:
currency: USD
memo:
metadata: {}
- created_at: '2026-08-15T05:10:42.639Z'
- updated_at: '2026-08-15T05:10:42.639Z'
+ created_at: '2026-08-15T06:58:31.855Z'
+ updated_at: '2026-08-15T06:58:31.855Z'
customer_id: cust_UkLWZg9DAJ
created_by_id: adm_UkLWZg9DAJ
category_id: sccat_UkLWZg9DAJ
@@ -4829,8 +4829,8 @@ paths:
currency: USD
memo: Goodwill
metadata: {}
- created_at: '2026-08-15T05:10:42.696Z'
- updated_at: '2026-08-15T05:10:42.696Z'
+ created_at: '2026-08-15T06:58:31.916Z'
+ updated_at: '2026-08-15T06:58:31.916Z'
customer_id: cust_UkLWZg9DAJ
created_by_id: adm_gbHJdmfrXB
category_id: sccat_UkLWZg9DAJ
@@ -4925,8 +4925,8 @@ paths:
currency: USD
memo: Updated
metadata: {}
- created_at: '2026-08-15T05:10:42.727Z'
- updated_at: '2026-08-15T05:10:42.747Z'
+ created_at: '2026-08-15T06:58:31.942Z'
+ updated_at: '2026-08-15T06:58:31.968Z'
customer_id: cust_UkLWZg9DAJ
created_by_id: adm_UkLWZg9DAJ
category_id: sccat_UkLWZg9DAJ
@@ -5085,8 +5085,8 @@ paths:
display_available_store_credit_total: "$0.00"
failed_attempts: 0
metadata: {}
- created_at: '2026-08-15T05:10:42.802Z'
- updated_at: '2026-08-15T05:10:42.802Z'
+ created_at: '2026-08-15T06:58:32.021Z'
+ updated_at: '2026-08-15T06:58:32.021Z'
tags: []
internal_note:
internal_note_html:
@@ -5169,8 +5169,8 @@ paths:
display_available_store_credit_total: "$0.00"
failed_attempts: 0
metadata: {}
- created_at: '2026-08-15T05:10:42.853Z'
- updated_at: '2026-08-15T05:10:42.853Z'
+ created_at: '2026-08-15T06:58:32.068Z'
+ updated_at: '2026-08-15T06:58:32.068Z'
tags: []
internal_note:
internal_note_html:
@@ -5285,8 +5285,8 @@ paths:
display_available_store_credit_total: "$0.00"
failed_attempts: 0
metadata: {}
- created_at: '2026-08-15T05:10:42.864Z'
- updated_at: '2026-08-15T05:10:42.864Z'
+ created_at: '2026-08-15T06:58:32.084Z'
+ updated_at: '2026-08-15T06:58:32.084Z'
tags: []
internal_note:
internal_note_html:
@@ -5359,8 +5359,8 @@ paths:
display_available_store_credit_total: "$0.00"
failed_attempts: 0
metadata: {}
- created_at: '2026-08-15T05:10:42.888Z'
- updated_at: '2026-08-15T05:10:42.905Z'
+ created_at: '2026-08-15T06:58:32.107Z'
+ updated_at: '2026-08-15T06:58:32.123Z'
tags: []
internal_note:
internal_note_html:
@@ -5808,8 +5808,8 @@ paths:
- id: exp_UkLWZg9DAJ
number: EF1001
format: csv
- created_at: '2026-08-15T05:10:43.548Z'
- updated_at: '2026-08-15T05:10:43.548Z'
+ created_at: '2026-08-15T06:58:32.745Z'
+ updated_at: '2026-08-15T06:58:32.745Z'
type: products
user_id: adm_UkLWZg9DAJ
done: false
@@ -5882,8 +5882,8 @@ paths:
id: exp_gbHJdmfrXB
number: EF1002
format: csv
- created_at: '2026-08-15T05:10:43.579Z'
- updated_at: '2026-08-15T05:10:43.579Z'
+ created_at: '2026-08-15T06:58:32.784Z'
+ updated_at: '2026-08-15T06:58:32.784Z'
type: products
user_id: adm_UkLWZg9DAJ
done: false
@@ -5982,8 +5982,8 @@ paths:
id: exp_UkLWZg9DAJ
number: EF1001
format: csv
- created_at: '2026-08-15T05:10:43.594Z'
- updated_at: '2026-08-15T05:10:43.594Z'
+ created_at: '2026-08-15T06:58:32.802Z'
+ updated_at: '2026-08-15T06:58:32.802Z'
type: products
user_id: adm_UkLWZg9DAJ
done: false
@@ -6199,8 +6199,8 @@ paths:
tracking_details:
adjustment_total: '0.0'
pre_tax_amount: '100.0'
- created_at: '2026-08-15T05:10:46.774Z'
- updated_at: '2026-08-15T05:10:46.784Z'
+ created_at: '2026-08-15T06:58:35.847Z'
+ updated_at: '2026-08-15T06:58:35.858Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
documents: []
@@ -6293,7 +6293,7 @@ paths:
display_tax_total: "$0.00"
status: fulfilled
fulfillment_type: shipping
- fulfilled_at: '2026-08-15T05:10:47.044Z'
+ fulfilled_at: '2026-08-15T06:58:36.107Z'
tracking_status:
estimated_delivery_at:
delivered_at:
@@ -6305,8 +6305,8 @@ paths:
tracking_details:
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-08-15T05:10:47.018Z'
- updated_at: '2026-08-15T05:10:47.045Z'
+ created_at: '2026-08-15T06:58:36.067Z'
+ updated_at: '2026-08-15T06:58:36.108Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
documents: []
@@ -6481,8 +6481,8 @@ paths:
tracking_details:
adjustment_total: '0.0'
pre_tax_amount: '100.0'
- created_at: '2026-08-15T05:10:47.449Z'
- updated_at: '2026-08-15T05:10:47.459Z'
+ created_at: '2026-08-15T06:58:36.476Z'
+ updated_at: '2026-08-15T06:58:36.487Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
documents: []
@@ -6579,8 +6579,8 @@ paths:
tracking_details:
adjustment_total: '0.0'
pre_tax_amount: '100.0'
- created_at: '2026-08-15T05:10:47.612Z'
- updated_at: '2026-08-15T05:10:47.674Z'
+ created_at: '2026-08-15T06:58:36.608Z'
+ updated_at: '2026-08-15T06:58:36.681Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
documents: []
@@ -6679,7 +6679,7 @@ paths:
display_tax_total: "$0.00"
status: fulfilled
fulfillment_type: shipping
- fulfilled_at: '2026-08-15T05:10:47.825Z'
+ fulfilled_at: '2026-08-15T06:58:36.832Z'
tracking_status:
estimated_delivery_at:
delivered_at:
@@ -6691,8 +6691,8 @@ paths:
tracking_details:
adjustment_total: '0.0'
pre_tax_amount: '100.0'
- created_at: '2026-08-15T05:10:47.752Z'
- updated_at: '2026-08-15T05:10:47.825Z'
+ created_at: '2026-08-15T06:58:36.763Z'
+ updated_at: '2026-08-15T06:58:36.833Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
documents: []
@@ -6795,8 +6795,8 @@ paths:
tracking_details:
adjustment_total: '0.0'
pre_tax_amount: '100.0'
- created_at: '2026-08-15T05:10:47.975Z'
- updated_at: '2026-08-15T05:10:48.110Z'
+ created_at: '2026-08-15T06:58:36.916Z'
+ updated_at: '2026-08-15T06:58:36.979Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
documents:
@@ -6895,10 +6895,10 @@ paths:
display_tax_total: "$0.00"
status: delivered
fulfillment_type: shipping
- fulfilled_at: '2026-08-15T05:10:48.413Z'
+ fulfilled_at: '2026-08-15T06:58:37.252Z'
tracking_status:
estimated_delivery_at:
- delivered_at: '2026-08-15T05:10:48.434Z'
+ delivered_at: '2026-08-15T06:58:37.272Z'
items:
- item_id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
@@ -6907,8 +6907,8 @@ paths:
tracking_details:
adjustment_total: '0.0'
pre_tax_amount: '100.0'
- created_at: '2026-08-15T05:10:48.339Z'
- updated_at: '2026-08-15T05:10:48.435Z'
+ created_at: '2026-08-15T06:58:37.201Z'
+ updated_at: '2026-08-15T06:58:37.273Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
documents: []
@@ -7027,8 +7027,8 @@ paths:
tracking_details:
adjustment_total: '0.0'
pre_tax_amount: '100.0'
- created_at: '2026-08-15T05:10:48.676Z'
- updated_at: '2026-08-15T05:10:48.756Z'
+ created_at: '2026-08-15T06:58:37.484Z'
+ updated_at: '2026-08-15T06:58:37.559Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
documents: []
@@ -7125,8 +7125,8 @@ paths:
tracking_details:
adjustment_total: '0.0'
pre_tax_amount: '100.0'
- created_at: '2026-08-15T05:10:48.861Z'
- updated_at: '2026-08-15T05:10:49.041Z'
+ created_at: '2026-08-15T06:58:37.652Z'
+ updated_at: '2026-08-15T06:58:37.729Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
documents: []
@@ -7234,8 +7234,8 @@ paths:
tracking_details:
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-08-15T05:10:49.274Z'
- updated_at: '2026-08-15T05:10:49.347Z'
+ created_at: '2026-08-15T06:58:37.902Z'
+ updated_at: '2026-08-15T06:58:37.971Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_gbHJdmfrXB
documents: []
@@ -7336,8 +7336,8 @@ paths:
codes_count: 2
currency: USD
prefix: WELCOME
- created_at: '2026-08-15T05:10:43.674Z'
- updated_at: '2026-08-15T05:10:43.674Z'
+ created_at: '2026-08-15T06:58:32.869Z'
+ updated_at: '2026-08-15T06:58:32.869Z'
amount: '50.0'
expires_at:
created_by_id:
@@ -7421,8 +7421,8 @@ paths:
codes_count: 5
currency: USD
prefix: NEWCAMP
- created_at: '2026-08-15T05:10:43.716Z'
- updated_at: '2026-08-15T05:10:43.716Z'
+ created_at: '2026-08-15T06:58:32.911Z'
+ updated_at: '2026-08-15T06:58:32.911Z'
amount: '25.0'
expires_at: '2030-12-31'
created_by_id: adm_UkLWZg9DAJ
@@ -7526,8 +7526,8 @@ paths:
codes_count: 2
currency: USD
prefix: WELCOME
- created_at: '2026-08-15T05:10:43.755Z'
- updated_at: '2026-08-15T05:10:43.755Z'
+ created_at: '2026-08-15T06:58:32.946Z'
+ updated_at: '2026-08-15T06:58:32.946Z'
amount: '50.0'
expires_at:
created_by_id:
@@ -7633,7 +7633,7 @@ paths:
example:
data:
- id: gc_UkLWZg9DAJ
- code: 4F0CA0553D8028C1
+ code: EA3F8EEA3A12E35F
status: active
currency: USD
amount: '50.0'
@@ -7647,12 +7647,12 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-08-15T05:10:43.813Z'
- updated_at: '2026-08-15T05:10:43.813Z'
+ created_at: '2026-08-15T06:58:33.003Z'
+ updated_at: '2026-08-15T06:58:33.003Z'
customer_id:
created_by_id:
- id: gc_gbHJdmfrXB
- code: EC4401149B9694BF
+ code: DD1437B0260E60AC
status: active
currency: USD
amount: '25.0'
@@ -7666,8 +7666,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-08-15T05:10:43.815Z'
- updated_at: '2026-08-15T05:10:43.815Z'
+ created_at: '2026-08-15T06:58:33.005Z'
+ updated_at: '2026-08-15T06:58:33.005Z'
customer_id:
created_by_id:
meta:
@@ -7755,7 +7755,7 @@ paths:
application/json:
example:
id: gc_EfhxLZ9ck8
- code: 12245351E7A941AA
+ code: D22FE8B11BBE44A4
status: active
currency: USD
amount: '25.0'
@@ -7769,8 +7769,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-08-15T05:10:43.882Z'
- updated_at: '2026-08-15T05:10:43.882Z'
+ created_at: '2026-08-15T06:58:33.065Z'
+ updated_at: '2026-08-15T06:58:33.065Z'
customer_id:
created_by_id: adm_UkLWZg9DAJ
schema:
@@ -7879,7 +7879,7 @@ paths:
application/json:
example:
id: gc_UkLWZg9DAJ
- code: CDAA60D734448626
+ code: E3AD2DF767AA856B
status: active
currency: USD
amount: '50.0'
@@ -7893,8 +7893,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-08-15T05:10:43.921Z'
- updated_at: '2026-08-15T05:10:43.921Z'
+ created_at: '2026-08-15T06:58:33.100Z'
+ updated_at: '2026-08-15T06:58:33.100Z'
customer_id:
created_by_id:
schema:
@@ -7957,7 +7957,7 @@ paths:
application/json:
example:
id: gc_UkLWZg9DAJ
- code: C303B831EBD379D3
+ code: 1F788C1B6A71B19D
status: active
currency: USD
amount: '75.0'
@@ -7971,8 +7971,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-08-15T05:10:43.966Z'
- updated_at: '2026-08-15T05:10:43.983Z'
+ created_at: '2026-08-15T06:58:33.149Z'
+ updated_at: '2026-08-15T06:58:33.164Z'
customer_id:
created_by_id:
schema:
@@ -8077,8 +8077,8 @@ paths:
- id: imp_UkLWZg9DAJ
number: IM1001
rows_count: 0
- created_at: '2026-08-15T05:10:44.067Z'
- updated_at: '2026-08-15T05:10:44.078Z'
+ created_at: '2026-08-15T06:58:33.245Z'
+ updated_at: '2026-08-15T06:58:33.252Z'
type: products
status: pending
owner_type: store
@@ -8256,8 +8256,8 @@ paths:
id: imp_gbHJdmfrXB
number: IM1002
rows_count: 0
- created_at: '2026-08-15T05:10:44.142Z'
- updated_at: '2026-08-15T05:10:44.178Z'
+ created_at: '2026-08-15T06:58:33.305Z'
+ updated_at: '2026-08-15T06:58:33.346Z'
type: products
status: mapping
owner_type: store
@@ -8694,8 +8694,8 @@ paths:
id: imp_UkLWZg9DAJ
number: IM1001
rows_count: 0
- created_at: '2026-08-15T05:10:44.305Z'
- updated_at: '2026-08-15T05:10:44.320Z'
+ created_at: '2026-08-15T06:58:33.565Z'
+ updated_at: '2026-08-15T06:58:33.583Z'
type: products
status: pending
owner_type: store
@@ -8931,8 +8931,8 @@ paths:
id: imp_gbHJdmfrXB
number: IM1002
rows_count: 0
- created_at: '2026-08-15T05:10:44.429Z'
- updated_at: '2026-08-15T05:10:44.497Z'
+ created_at: '2026-08-15T06:58:33.686Z'
+ updated_at: '2026-08-15T06:58:33.756Z'
type: products
status: completed_mapping
owner_type: store
@@ -9267,8 +9267,8 @@ paths:
id: imp_gbHJdmfrXB
number: IM1002
rows_count: 1
- created_at: '2026-08-15T05:10:44.541Z'
- updated_at: '2026-08-15T05:10:44.571Z'
+ created_at: '2026-08-15T06:58:33.794Z'
+ updated_at: '2026-08-15T06:58:33.814Z'
type: products
status: processing
owner_type: store
@@ -9441,8 +9441,8 @@ paths:
row_number: 2
status: failed
validation_errors: boom
- created_at: '2026-08-15T05:10:44.685Z'
- updated_at: '2026-08-15T05:10:44.685Z'
+ created_at: '2026-08-15T06:58:33.842Z'
+ updated_at: '2026-08-15T06:58:33.842Z'
import_id: imp_UkLWZg9DAJ
item_type:
item_id:
@@ -9540,26 +9540,26 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:38.584Z'
- updated_at: '2026-08-15T05:10:38.584Z'
+ created_at: '2026-08-15T06:58:28.077Z'
+ updated_at: '2026-08-15T06:58:28.077Z'
- id: mkt_gbHJdmfrXB
name: EU
currency: USD
default_locale: en
tax_inclusive: false
default: false
- country_isos:
+ country_codes:
- DE
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:45.026Z'
- updated_at: '2026-08-15T05:10:45.026Z'
+ created_at: '2026-08-15T06:58:34.082Z'
+ updated_at: '2026-08-15T06:58:34.082Z'
meta:
page: 1
limit: 25
@@ -9592,7 +9592,7 @@ paths:
description: |-
Creates a new market for the current store.
- - `country_isos` accepts 2-letter ISO country codes (e.g. `["DE", "FR"]`);
+ - `country_codes` accepts 2-letter ISO country codes (e.g. `["DE", "FR"]`);
the market must contain at least one country. Unknown codes are
silently dropped.
- `supported_locales` accepts an array of locale codes; the
@@ -9619,11 +9619,11 @@ paths:
default_locale: 'de',
supported_locales: ['de', 'en', 'fr'],
tax_inclusive: true,
- country_isos: ['DE', 'FR', 'IT'],
+ country_codes: ['DE', 'FR', 'IT'],
})
- lang: bash
label: Spree CLI
- source: spree api post /markets -d '{"name":"Europe","currency":"EUR","default_locale":"de","supported_locales":["de","en","fr"],"tax_inclusive":true,"country_isos":["DE","FR","IT"]}'
+ source: spree api post /markets -d '{"name":"Europe","currency":"EUR","default_locale":"de","supported_locales":["de","en","fr"],"tax_inclusive":true,"country_codes":["DE","FR","IT"]}'
parameters:
- name: x-spree-api-key
in: header
@@ -9647,14 +9647,14 @@ paths:
default_locale: fr
tax_inclusive: true
default: false
- country_isos:
+ country_codes:
- FR
supported_locales:
- en
- fr
tax_provider:
- created_at: '2026-08-15T05:10:45.082Z'
- updated_at: '2026-08-15T05:10:45.082Z'
+ created_at: '2026-08-15T06:58:34.150Z'
+ updated_at: '2026-08-15T06:58:34.150Z'
schema:
"$ref": "#/components/schemas/Market"
'422':
@@ -9714,7 +9714,7 @@ paths:
position:
type: integer
description: Sort order within the store; lower = first.
- country_isos:
+ country_codes:
type: array
items:
type: string
@@ -9727,7 +9727,7 @@ paths:
- name
- currency
- default_locale
- - country_isos
+ - country_codes
"/api/v3/admin/markets/{id}":
parameters:
- name: id
@@ -9786,13 +9786,13 @@ paths:
default_locale: en
tax_inclusive: false
default: false
- country_isos:
+ country_codes:
- DE
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:45.144Z'
- updated_at: '2026-08-15T05:10:45.144Z'
+ created_at: '2026-08-15T06:58:34.207Z'
+ updated_at: '2026-08-15T06:58:34.207Z'
schema:
"$ref": "#/components/schemas/Market"
'404':
@@ -9813,7 +9813,7 @@ paths:
- api_key: []
bearer_auth: []
description: |-
- Updates an existing market. Pass `country_isos` to replace the
+ Updates an existing market. Pass `country_codes` to replace the
market's country list (full-set update), `supported_locales` to
replace the supported locales, or `position` to reorder the market
within the store.
@@ -9833,17 +9833,17 @@ paths:
secretKey: 'sk_xxx',
})
- // `country_isos` is a full-set update — the market is reconciled to match
+ // `country_codes` is a full-set update — the market is reconciled to match
// the array (adds new countries, removes ones not present). Setting
// `default: true` demotes the previous default market in the store.
const market = await client.markets.update('market_UkLWZg9DAJ', {
name: 'European Union',
tax_inclusive: true,
- country_isos: ['DE', 'FR'],
+ country_codes: ['DE', 'FR'],
})
- lang: bash
label: Spree CLI
- source: spree api patch /markets/{id} -d '{"name":"European Union","tax_inclusive":true,"country_isos":["DE","FR"]}'
+ source: spree api patch /markets/{id} -d '{"name":"European Union","tax_inclusive":true,"country_codes":["DE","FR"]}'
parameters:
- name: x-spree-api-key
in: header
@@ -9867,13 +9867,13 @@ paths:
default_locale: en
tax_inclusive: true
default: false
- country_isos:
+ country_codes:
- DE
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:45.206Z'
- updated_at: '2026-08-15T05:10:45.227Z'
+ created_at: '2026-08-15T06:58:34.272Z'
+ updated_at: '2026-08-15T06:58:34.289Z'
schema:
"$ref": "#/components/schemas/Market"
'422':
@@ -9911,7 +9911,7 @@ paths:
type: boolean
position:
type: integer
- country_isos:
+ country_codes:
type: array
items:
type: string
@@ -10053,8 +10053,8 @@ paths:
kind: dropdown
metadata: {}
filterable: true
- created_at: '2026-08-15T05:10:45.416Z'
- updated_at: '2026-08-15T05:10:45.416Z'
+ created_at: '2026-08-15T06:58:34.575Z'
+ updated_at: '2026-08-15T06:58:34.575Z'
meta:
page: 1
limit: 25
@@ -10148,8 +10148,8 @@ paths:
kind: dropdown
metadata: {}
filterable: true
- created_at: '2026-08-15T05:10:45.468Z'
- updated_at: '2026-08-15T05:10:45.468Z'
+ created_at: '2026-08-15T06:58:34.633Z'
+ updated_at: '2026-08-15T06:58:34.633Z'
schema:
"$ref": "#/components/schemas/OptionType"
'422':
@@ -10273,8 +10273,8 @@ paths:
kind: dropdown
metadata: {}
filterable: true
- created_at: '2026-08-15T05:10:45.503Z'
- updated_at: '2026-08-15T05:10:45.503Z'
+ created_at: '2026-08-15T06:58:34.664Z'
+ updated_at: '2026-08-15T06:58:34.664Z'
schema:
"$ref": "#/components/schemas/OptionType"
'404':
@@ -10347,8 +10347,8 @@ paths:
kind: dropdown
metadata: {}
filterable: true
- created_at: '2026-08-15T05:10:45.551Z'
- updated_at: '2026-08-15T05:10:45.568Z'
+ created_at: '2026-08-15T06:58:34.709Z'
+ updated_at: '2026-08-15T06:58:34.724Z'
schema:
"$ref": "#/components/schemas/OptionType"
'422':
@@ -10509,11 +10509,11 @@ paths:
provider_id: internal
metadata: {}
taxability_reason:
- country_iso:
+ country_code:
state_code:
data: {}
- created_at: '2026-08-15T05:10:45.829Z'
- updated_at: '2026-08-15T05:10:45.829Z'
+ created_at: '2026-08-15T06:58:34.967Z'
+ updated_at: '2026-08-15T06:58:34.967Z'
meta:
page: 1
limit: 25
@@ -10587,8 +10587,8 @@ paths:
amount: "-2.0"
display_amount: "-$2.00"
metadata: {}
- created_at: '2026-08-15T05:10:46.051Z'
- updated_at: '2026-08-15T05:10:46.051Z'
+ created_at: '2026-08-15T06:58:35.091Z'
+ updated_at: '2026-08-15T06:58:35.091Z'
meta:
page: 1
limit: 25
@@ -10668,8 +10668,8 @@ paths:
amount: "-3.0"
display_amount: "-$3.00"
metadata: {}
- created_at: '2026-08-15T05:10:46.185Z'
- updated_at: '2026-08-15T05:10:46.185Z'
+ created_at: '2026-08-15T06:58:35.243Z'
+ updated_at: '2026-08-15T06:58:35.243Z'
'422':
description: invalid discount
content:
@@ -10766,8 +10766,8 @@ paths:
amount: '4.0'
display_amount: "$4.00"
metadata: {}
- created_at: '2026-08-15T05:10:46.427Z'
- updated_at: '2026-08-15T05:10:46.427Z'
+ created_at: '2026-08-15T06:58:35.503Z'
+ updated_at: '2026-08-15T06:58:35.503Z'
'422':
description: invalid fee
content:
@@ -10864,7 +10864,7 @@ paths:
application/json:
example:
id: gc_UkLWZg9DAJ
- code: 702FAB1E4CCBE4D4
+ code: EB72080196E6198E
status: active
currency: USD
amount: '10.0'
@@ -10878,8 +10878,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-08-15T05:10:49.480Z'
- updated_at: '2026-08-15T05:10:49.518Z'
+ created_at: '2026-08-15T06:58:38.162Z'
+ updated_at: '2026-08-15T06:58:38.197Z'
customer_id:
created_by_id:
requestBody:
@@ -11020,8 +11020,8 @@ paths:
preorder_ships_at:
quantity: 2
currency: USD
- name: Product 311934
- slug: product-311934
+ name: Product 319055
+ slug: product-319055
options_text: 'Size: S'
price: '10.0'
display_price: "$10.00"
@@ -11053,12 +11053,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-08-15T05:10:49.799Z'
- updated_at: '2026-08-15T05:10:49.799Z'
+ created_at: '2026-08-15T06:58:38.403Z'
+ updated_at: '2026-08-15T06:58:38.403Z'
digital_links: []
metadata: {}
- created_at: '2026-08-15T05:10:49.840Z'
- updated_at: '2026-08-15T05:10:49.840Z'
+ created_at: '2026-08-15T06:58:38.431Z'
+ updated_at: '2026-08-15T06:58:38.431Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
meta:
@@ -11130,8 +11130,8 @@ paths:
preorder_ships_at:
quantity: 3
currency: USD
- name: Product 336661
- slug: product-336661
+ name: Product 339322
+ slug: product-339322
options_text: 'Size: S'
price: '19.99'
display_price: "$19.99"
@@ -11163,12 +11163,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-08-15T05:10:50.029Z'
- updated_at: '2026-08-15T05:10:50.029Z'
+ created_at: '2026-08-15T06:58:38.584Z'
+ updated_at: '2026-08-15T06:58:38.584Z'
digital_links: []
metadata: {}
- created_at: '2026-08-15T05:10:50.065Z'
- updated_at: '2026-08-15T05:10:50.065Z'
+ created_at: '2026-08-15T06:58:38.610Z'
+ updated_at: '2026-08-15T06:58:38.610Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
requestBody:
@@ -11262,8 +11262,8 @@ paths:
preorder_ships_at:
quantity: 2
currency: USD
- name: Product 342925
- slug: product-342925
+ name: Product 349097
+ slug: product-349097
options_text: 'Size: S'
price: '10.0'
display_price: "$10.00"
@@ -11295,12 +11295,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-08-15T05:10:50.170Z'
- updated_at: '2026-08-15T05:10:50.170Z'
+ created_at: '2026-08-15T06:58:38.707Z'
+ updated_at: '2026-08-15T06:58:38.707Z'
digital_links: []
metadata: {}
- created_at: '2026-08-15T05:10:50.198Z'
- updated_at: '2026-08-15T05:10:50.198Z'
+ created_at: '2026-08-15T06:58:38.738Z'
+ updated_at: '2026-08-15T06:58:38.738Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
patch:
@@ -11367,8 +11367,8 @@ paths:
preorder_ships_at:
quantity: 5
currency: USD
- name: Product 355556
- slug: product-355556
+ name: Product 357145
+ slug: product-357145
options_text: 'Size: S'
price: '19.99'
display_price: "$19.99"
@@ -11400,12 +11400,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-08-15T05:10:50.296Z'
- updated_at: '2026-08-15T05:10:50.296Z'
+ created_at: '2026-08-15T06:58:38.816Z'
+ updated_at: '2026-08-15T06:58:38.816Z'
digital_links: []
metadata: {}
- created_at: '2026-08-15T05:10:50.382Z'
- updated_at: '2026-08-15T05:10:50.445Z'
+ created_at: '2026-08-15T06:58:38.845Z'
+ updated_at: '2026-08-15T06:58:38.881Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
requestBody:
@@ -11527,7 +11527,7 @@ paths:
cart_id:
channel_id: ch_UkLWZg9DAJ
number: R1001
customer_note:
currency: USD
locale: en
@@ -11567,13 +11567,13 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:38.584Z'
- updated_at: '2026-08-15T05:10:38.584Z'
+ created_at: '2026-08-15T06:58:28.077Z'
+ updated_at: '2026-08-15T06:58:28.077Z'
status: draft
last_ip_address:
considered_risky: false
@@ -11584,8 +11584,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-08-15T05:10:52.523Z'
- updated_at: '2026-08-15T05:10:52.584Z'
+ created_at: '2026-08-15T06:58:40.331Z'
+ updated_at: '2026-08-15T06:58:40.401Z'
preferred_stock_location_id:
company_location_id:
company_id:
@@ -11767,7 +11767,7 @@ paths:
cart_id:
channel_id: ch_UkLWZg9DAJ
number: R1001
customer_note:
currency: USD
locale: en
@@ -11807,13 +11807,13 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:38.584Z'
- updated_at: '2026-08-15T05:10:38.584Z'
+ created_at: '2026-08-15T06:58:28.077Z'
+ updated_at: '2026-08-15T06:58:28.077Z'
status: draft
last_ip_address:
considered_risky: false
@@ -11824,8 +11824,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-08-15T05:10:52.820Z'
- updated_at: '2026-08-15T05:10:52.820Z'
+ created_at: '2026-08-15T06:58:40.723Z'
+ updated_at: '2026-08-15T06:58:40.723Z'
preferred_stock_location_id:
company_location_id:
company_id:
@@ -11916,7 +11916,7 @@ paths:
address2: 'Floor 42',
city: 'New York',
postal_code: '10118',
- country_iso: 'US',
+ country_code: 'US',
state_code: 'NY',
phone: '+1 212 555 1234',
company: 'Acme Inc.',
@@ -11929,7 +11929,7 @@ paths:
address1: '350 Fifth Avenue',
city: 'New York',
postal_code: '10118',
- country_iso: 'US',
+ country_code: 'US',
state_code: 'NY',
phone: '+1 212 555 1234',
},
@@ -11943,9 +11943,9 @@ paths:
source: spree api post /orders -d '{"email":"[email protected]","customer_id":"cus_UkLWZg9DAJ","use_customer_default_address":false,"currency":"USD","market_id":"mkt_UkLWZg9DAJ","channel_id":"ch_UkLWZg9DAJ","locale":"en-US","preferred_stock_location_id":"sloc_UkLWZg9DAJ","customer_note":"Please
leave at the front desk.","internal_note":"<p>VIP customer — handle with
care.</p>","metadata":{"external_reference":"subscription_invoice_2026_04","source":"recurring-engine"},"items":[{"variant_id":"variant_k5nR8xLq","quantity":2},{"variant_id":"variant_QXyZ12abCD","quantity":1,"metadata":{"gift":true}}],"shipping_address":{"first_name":"Jane","last_name":"Doe","address1":"350
- Fifth Avenue","address2":"Floor 42","city":"New York","postal_code":"10118","country_iso":"US","state_code":"NY","phone":"+1
+ Fifth Avenue","address2":"Floor 42","city":"New York","postal_code":"10118","country_code":"US","state_code":"NY","phone":"+1
212 555 1234","company":"Acme Inc."},"billing_address":{"first_name":"Jane","last_name":"Doe","address1":"350
- Fifth Avenue","city":"New York","postal_code":"10118","country_iso":"US","state_code":"NY","phone":"+1
+ Fifth Avenue","city":"New York","postal_code":"10118","country_code":"US","state_code":"NY","phone":"+1
212 555 1234"},"coupon_code":"WELCOME10"}'
description: |-
Creates a new draft order in one shot. Customer, items, addresses, currency,
@@ -12024,13 +12024,13 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:38.584Z'
- updated_at: '2026-08-15T05:10:38.584Z'
+ created_at: '2026-08-15T06:58:28.077Z'
+ updated_at: '2026-08-15T06:58:28.077Z'
status: draft
last_ip_address:
considered_risky: false
@@ -12041,8 +12041,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-08-15T05:10:53.081Z'
- updated_at: '2026-08-15T05:10:53.085Z'
+ created_at: '2026-08-15T06:58:40.868Z'
+ updated_at: '2026-08-15T06:58:40.872Z'
preferred_stock_location_id: sloc_UkLWZg9DAJ
company_location_id:
company_id:
@@ -12110,7 +12110,7 @@ paths:
type: string
postal_code:
type: string
- country_iso:
+ country_code:
type: string
state_code:
type: string
@@ -12132,7 +12132,7 @@ paths:
type: string
postal_code:
type: string
- country_iso:
+ country_code:
type: string
state_code:
type: string
@@ -12234,7 +12234,7 @@ paths:
cart_id:
channel_id: ch_UkLWZg9DAJ
number: R1001
customer_note:
currency: USD
locale: en
@@ -12274,13 +12274,13 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:38.584Z'
- updated_at: '2026-08-15T05:10:38.584Z'
+ created_at: '2026-08-15T06:58:28.077Z'
+ updated_at: '2026-08-15T06:58:28.077Z'
status: draft
last_ip_address:
considered_risky: false
@@ -12291,8 +12291,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-08-15T05:10:53.121Z'
- updated_at: '2026-08-15T05:10:53.121Z'
+ created_at: '2026-08-15T06:58:40.899Z'
+ updated_at: '2026-08-15T06:58:40.899Z'
preferred_stock_location_id:
company_location_id:
company_id:
@@ -12412,13 +12412,13 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:38.584Z'
- updated_at: '2026-08-15T05:10:38.584Z'
+ created_at: '2026-08-15T06:58:28.077Z'
+ updated_at: '2026-08-15T06:58:28.077Z'
status: draft
last_ip_address:
considered_risky: false
@@ -12429,8 +12429,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-08-15T05:10:53.241Z'
- updated_at: '2026-08-15T05:10:53.274Z'
+ created_at: '2026-08-15T06:58:40.977Z'
+ updated_at: '2026-08-15T06:58:41.001Z'
preferred_stock_location_id:
company_location_id:
company_id:
@@ -12474,7 +12474,7 @@ paths:
type: string
zipcode:
type: string
- country_iso:
+ country_code:
type: string
state_code:
type: string
@@ -12493,7 +12493,7 @@ paths:
type: string
zipcode:
type: string
- country_iso:
+ country_code:
type: string
state_code:
type: string
@@ -12622,7 +12622,7 @@ paths:
cart_id:
channel_id: ch_UkLWZg9DAJ
number: R1001
customer_note:
currency: USD
locale: en
@@ -12630,7 +12630,7 @@ paths:
coupon_code:
fulfillment_status: unfulfilled
payment_status: paid
- completed_at: '2026-08-15T05:10:53.489Z'
+ completed_at: '2026-08-15T06:58:41.164Z'
item_total: '10.0'
display_item_total: "$10.00"
adjustment_total: '0.0'
@@ -12662,13 +12662,13 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:38.584Z'
- updated_at: '2026-08-15T05:10:38.584Z'
+ created_at: '2026-08-15T06:58:28.077Z'
+ updated_at: '2026-08-15T06:58:28.077Z'
status: placed
last_ip_address:
considered_risky: false
@@ -12679,8 +12679,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-08-15T05:10:53.399Z'
- updated_at: '2026-08-15T05:10:53.517Z'
+ created_at: '2026-08-15T06:58:41.101Z'
+ updated_at: '2026-08-15T06:58:41.190Z'
preferred_stock_location_id:
company_location_id:
company_id:
@@ -12772,7 +12772,7 @@ paths:
cart_id:
channel_id: ch_UkLWZg9DAJ
number: R1001
customer_note:
currency: USD
locale: en
@@ -12780,7 +12780,7 @@ paths:
coupon_code:
fulfillment_status: canceled
payment_status: none
- completed_at: '2026-08-15T05:10:53.823Z'
+ completed_at: '2026-08-15T06:58:41.414Z'
item_total: '10.0'
display_item_total: "$10.00"
adjustment_total: '0.0'
@@ -12812,13 +12812,13 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:38.584Z'
- updated_at: '2026-08-15T05:10:38.584Z'
+ created_at: '2026-08-15T06:58:28.077Z'
+ updated_at: '2026-08-15T06:58:28.077Z'
status: canceled
last_ip_address:
considered_risky: false
@@ -12827,10 +12827,10 @@ paths:
payment_total: '0.0'
display_payment_total: "$0.00"
metadata: {}
- canceled_at: '2026-08-15T05:10:53.859Z'
+ canceled_at: '2026-08-15T06:58:41.446Z'
approved_at:
- created_at: '2026-08-15T05:10:53.744Z'
- updated_at: '2026-08-15T05:10:53.886Z'
+ created_at: '2026-08-15T06:58:41.351Z'
+ updated_at: '2026-08-15T06:58:41.466Z'
preferred_stock_location_id:
company_location_id:
company_id:
@@ -12906,7 +12906,7 @@ paths:
cart_id:
channel_id: ch_UkLWZg9DAJ
number: R1001
customer_note:
currency: USD
locale: en
@@ -12914,7 +12914,7 @@ paths:
coupon_code:
fulfillment_status:
payment_status:
- completed_at: '2026-08-15T05:10:54.065Z'
+ completed_at: '2026-08-15T06:58:41.590Z'
item_total: '10.0'
display_item_total: "$10.00"
adjustment_total: '0.0'
@@ -12946,13 +12946,13 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:38.584Z'
- updated_at: '2026-08-15T05:10:38.584Z'
+ created_at: '2026-08-15T06:58:28.077Z'
+ updated_at: '2026-08-15T06:58:28.077Z'
status: placed
last_ip_address:
considered_risky: false
@@ -12962,9 +12962,9 @@ paths:
display_payment_total: "$0.00"
metadata: {}
canceled_at:
- approved_at: '2026-08-15T05:10:54.118Z'
- created_at: '2026-08-15T05:10:53.961Z'
- updated_at: '2026-08-15T05:10:54.064Z'
+ approved_at: '2026-08-15T06:58:41.622Z'
+ created_at: '2026-08-15T06:58:41.531Z'
+ updated_at: '2026-08-15T06:58:41.589Z'
preferred_stock_location_id:
company_location_id:
company_id:
@@ -13031,7 +13031,7 @@ paths:
cart_id:
channel_id: ch_UkLWZg9DAJ
number: R1001
customer_note:
currency: USD
locale: en
@@ -13039,7 +13039,7 @@ paths:
coupon_code:
fulfillment_status: unfulfilled
payment_status: none
- completed_at: '2026-08-15T05:10:54.251Z'
+ completed_at: '2026-08-15T06:58:41.721Z'
item_total: '10.0'
display_item_total: "$10.00"
adjustment_total: '0.0'
@@ -13071,13 +13071,13 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:38.584Z'
- updated_at: '2026-08-15T05:10:38.584Z'
+ created_at: '2026-08-15T06:58:28.077Z'
+ updated_at: '2026-08-15T06:58:28.077Z'
status: placed
last_ip_address:
considered_risky: false
@@ -13086,10 +13086,10 @@ paths:
payment_total: '0.0'
display_payment_total: "$0.00"
metadata: {}
- canceled_at: '2026-08-15T05:10:54.276Z'
+ canceled_at: '2026-08-15T06:58:41.747Z'
approved_at:
- created_at: '2026-08-15T05:10:54.176Z'
- updated_at: '2026-08-15T05:10:54.350Z'
+ created_at: '2026-08-15T06:58:41.663Z'
+ updated_at: '2026-08-15T06:58:41.795Z'
preferred_stock_location_id:
company_location_id:
company_id:
@@ -13156,7 +13156,7 @@ paths:
cart_id:
channel_id: ch_UkLWZg9DAJ
number: R1001
customer_note:
currency: USD
locale: en
@@ -13164,7 +13164,7 @@ paths:
coupon_code:
fulfillment_status:
payment_status:
- completed_at: '2026-08-15T05:10:54.478Z'
+ completed_at: '2026-08-15T06:58:41.897Z'
item_total: '10.0'
display_item_total: "$10.00"
adjustment_total: '0.0'
@@ -13196,13 +13196,13 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
tax_provider:
- created_at: '2026-08-15T05:10:38.584Z'
- updated_at: '2026-08-15T05:10:38.584Z'
+ created_at: '2026-08-15T06:58:28.077Z'
+ updated_at: '2026-08-15T06:58:28.077Z'
status: placed
last_ip_address:
considered_risky: false
@@ -13213,8 +13213,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-08-15T05:10:54.398Z'
- updated_at: '2026-08-15T05:10:54.478Z'
+ created_at: '2026-08-15T06:58:41.832Z'
+ updated_at: '2026-08-15T06:58:41.897Z'
preferred_stock_location_id:
company_location_id:
company_id:
@@ -13297,8 +13297,8 @@ paths:
resolved_capture_method: checkout
storefront_visible: true
position: 1
- created_at: '2026-08-15T05:10:54.602Z'
- updated_at: '2026-08-15T05:10:54.602Z'
+ created_at: '2026-08-15T06:58:42.012Z'
+ updated_at: '2026-08-15T06:58:42.012Z'
preferences: {}
preference_schema: []
meta:
@@ -13446,8 +13446,8 @@ paths:
resolved_capture_method: checkout
storefront_visible: true
position: 1
- created_at: '2026-08-15T05:10:54.704Z'
- updated_at: '2026-08-15T05:10:54.704Z'
+ created_at: '2026-08-15T06:58:42.067Z'
+ updated_at: '2026-08-15T06:58:42.067Z'
preferences: {}
preference_schema: []
"/api/v3/admin/orders/{order_id}/payments":
@@ -13518,7 +13518,7 @@ paths:
data:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-e19b45eaa115
+ response_code: BGS-662650d8fd89
number: R1001-P1
amount: '110.0'
display_amount: "$110.00"
@@ -13537,14 +13537,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-08-15T05:10:50.786Z'
- updated_at: '2026-08-15T05:10:50.790Z'
+ created_at: '2026-08-15T06:58:39.104Z'
+ updated_at: '2026-08-15T06:58:39.107Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-08-15T05:10:50.788Z'
- updated_at: '2026-08-15T05:10:50.788Z'
+ created_at: '2026-08-15T06:58:39.105Z'
+ updated_at: '2026-08-15T06:58:39.105Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
meta:
@@ -13625,8 +13625,8 @@ paths:
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-08-15T05:10:51.230Z'
- updated_at: '2026-08-15T05:10:51.230Z'
+ created_at: '2026-08-15T06:58:39.383Z'
+ updated_at: '2026-08-15T06:58:39.383Z'
captured_amount: '0.0'
order_id: or_gbHJdmfrXB
requestBody:
@@ -13719,7 +13719,7 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-74bad9e7bd5c
+ response_code: BGS-e9f5b3e49ece
number: R1001-P1
amount: '110.0'
display_amount: "$110.00"
@@ -13738,14 +13738,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-08-15T05:10:51.371Z'
- updated_at: '2026-08-15T05:10:51.375Z'
+ created_at: '2026-08-15T06:58:39.496Z'
+ updated_at: '2026-08-15T06:58:39.499Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-08-15T05:10:51.373Z'
- updated_at: '2026-08-15T05:10:51.373Z'
+ created_at: '2026-08-15T06:58:39.498Z'
+ updated_at: '2026-08-15T06:58:39.498Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
"/api/v3/admin/orders/{order_id}/payments/{id}/capture":
@@ -13808,7 +13808,7 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-f45691f41c39
+ response_code: BGS-7a39f82da69c
number: R1001-P1
amount: '110.0'
display_amount: "$110.00"
@@ -13827,14 +13827,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-08-15T05:10:51.501Z'
- updated_at: '2026-08-15T05:10:51.503Z'
+ created_at: '2026-08-15T06:58:39.639Z'
+ updated_at: '2026-08-15T06:58:39.642Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-08-15T05:10:51.502Z'
- updated_at: '2026-08-15T05:10:51.536Z'
+ created_at: '2026-08-15T06:58:39.640Z'
+ updated_at: '2026-08-15T06:58:39.675Z'
captured_amount: '110.0'
order_id: or_UkLWZg9DAJ
'422':
@@ -13906,7 +13906,7 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: void-BGS-24e4d0016d92
+ response_code: void-BGS-56cea42c3ebd
number: R1001-P1
amount: '110.0'
display_amount: "$110.00"
@@ -13925,14 +13925,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-08-15T05:10:51.948Z'
- updated_at: '2026-08-15T05:10:51.952Z'
+ created_at: '2026-08-15T06:58:39.955Z'
+ updated_at: '2026-08-15T06:58:39.958Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-08-15T05:10:51.950Z'
- updated_at: '2026-08-15T05:10:51.977Z'
+ created_at: '2026-08-15T06:58:39.956Z'
+ updated_at: '2026-08-15T06:58:39.979Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
"/api/v3/admin/price_lists":
@@ -14020,8 +14020,8 @@ paths:
starts_at:
ends_at:
deleted_at:
- created_at: '2026-08-15T05:10:54.794Z'
- updated_at: '2026-08-15T05:10:54.794Z'
+ created_at: '2026-08-15T06:58:42.117Z'
+ updated_at: '2026-08-15T06:58:42.117Z'
currently_active: false
products_count: 0
prices_count: 0
@@ -14035,8 +14035,8 @@ paths:
starts_at:
ends_at:
deleted_at:
- created_at: '2026-08-15T05:10:54.796Z'
- updated_at: '2026-08-15T05:10:54.796Z'
+ created_at: '2026-08-15T06:58:42.118Z'
+ updated_at: '2026-08-15T06:58:42.118Z'
currently_active: false
products_count: 0
prices_count: 0
@@ -14150,8 +14150,8 @@ paths:
starts_at:
ends_at:
deleted_at:
- created_at: '2026-08-15T05:10:55.325Z'
- updated_at: '2026-08-15T05:10:55.329Z'
+ created_at: '2026-08-15T06:58:42.354Z'
+ updated_at: '2026-08-15T06:58:42.356Z'
currently_active: false
products_count: 1
prices_count: 2
@@ -14314,8 +14314,8 @@ paths:
starts_at:
ends_at:
deleted_at:
- created_at: '2026-08-15T05:10:55.470Z'
- updated_at: '2026-08-15T05:10:55.470Z'
+ created_at: '2026-08-15T06:58:42.398Z'
+ updated_at: '2026-08-15T06:58:42.398Z'
currently_active: false
products_count: 0
prices_count: 0
@@ -14390,8 +14390,8 @@ paths:
starts_at:
ends_at:
deleted_at:
- created_at: '2026-08-15T05:10:55.800Z'
- updated_at: '2026-08-15T05:10:55.816Z'
+ created_at: '2026-08-15T06:58:42.691Z'
+ updated_at: '2026-08-15T06:58:42.708Z'
currently_active: false
products_count: 0
prices_count: 0
@@ -14579,8 +14579,8 @@ paths:
starts_at:
ends_at:
deleted_at:
- created_at: '2026-08-15T05:10:55.858Z'
- updated_at: '2026-08-15T05:10:55.875Z'
+ created_at: '2026-08-15T06:58:42.752Z'
+ updated_at: '2026-08-15T06:58:42.775Z'
currently_active: true
products_count: 0
prices_count: 0
@@ -14643,8 +14643,8 @@ paths:
starts_at:
ends_at:
deleted_at:
- created_at: '2026-08-15T05:10:55.888Z'
- updated_at: '2026-08-15T05:10:55.904Z'
+ created_at: '2026-08-15T06:58:42.788Z'
+ updated_at: '2026-08-15T06:58:42.805Z'
currently_active: false
products_count: 0
prices_count: 0
@@ -14758,8 +14758,8 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-08-15T05:10:55.948Z'
- updated_at: '2026-08-15T05:10:55.948Z'
+ created_at: '2026-08-15T06:58:42.847Z'
+ updated_at: '2026-08-15T06:58:42.847Z'
- id: price_gbHJdmfrXB
amount: '19.99'
amount_in_cents: 1999
@@ -14770,8 +14770,8 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_gbHJdmfrXB
- created_at: '2026-08-15T05:10:55.981Z'
- updated_at: '2026-08-15T05:10:55.981Z'
+ created_at: '2026-08-15T06:58:42.876Z'
+ updated_at: '2026-08-15T06:58:42.876Z'
- id: price_EfhxLZ9ck8
amount: '5.0'
amount_in_cents: 500
@@ -14782,8 +14782,8 @@ paths:
display_compare_at_amount:
price_list_id: pl_UkLWZg9DAJ
variant_id: variant_gbHJdmfrXB
- created_at: '2026-08-15T05:10:55.986Z'
- updated_at: '2026-08-15T05:10:55.986Z'
+ created_at: '2026-08-15T06:58:42.880Z'
+ updated_at: '2026-08-15T06:58:42.880Z'
meta:
page: 1
limit: 25
@@ -14865,8 +14865,8 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_EfhxLZ9ck8
- created_at: '2026-08-15T05:10:56.118Z'
- updated_at: '2026-08-15T05:10:56.118Z'
+ created_at: '2026-08-15T06:58:43.052Z'
+ updated_at: '2026-08-15T06:58:43.052Z'
schema:
"$ref": "#/components/schemas/Price"
requestBody:
@@ -14953,8 +14953,8 @@ paths:
display_compare_at_amount:
price_list_id: pl_UkLWZg9DAJ
variant_id: variant_gbHJdmfrXB
- created_at: '2026-08-15T05:10:56.191Z'
- updated_at: '2026-08-15T05:10:56.191Z'
+ created_at: '2026-08-15T06:58:43.147Z'
+ updated_at: '2026-08-15T06:58:43.147Z'
schema:
"$ref": "#/components/schemas/Price"
'404':
@@ -15019,8 +15019,8 @@ paths:
display_compare_at_amount:
price_list_id: pl_UkLWZg9DAJ
variant_id: variant_gbHJdmfrXB
- created_at: '2026-08-15T05:10:56.366Z'
- updated_at: '2026-08-15T05:10:56.380Z'
+ created_at: '2026-08-15T06:58:43.329Z'
+ updated_at: '2026-08-15T06:58:43.346Z'
schema:
"$ref": "#/components/schemas/Price"
requestBody:
@@ -15332,8 +15332,8 @@ paths:
field_type: short_text
key: custom.title
value: wool
- created_at: '2026-08-15T05:10:57.204Z'
- updated_at: '2026-08-15T05:10:57.204Z'
+ created_at: '2026-08-15T06:58:44.000Z'
+ updated_at: '2026-08-15T06:58:44.000Z'
storefront_visible: true
custom_field_definition_id: cfdef_UkLWZg9DAJ
meta:
@@ -15403,8 +15403,8 @@ paths:
field_type: long_text
key: custom.description
value: A longer description
- created_at: '2026-08-15T05:10:57.343Z'
- updated_at: '2026-08-15T05:10:57.343Z'
+ created_at: '2026-08-15T06:58:44.083Z'
+ updated_at: '2026-08-15T06:58:44.083Z'
storefront_visible: true
custom_field_definition_id: cfdef_gbHJdmfrXB
'422':
@@ -15503,8 +15503,8 @@ paths:
field_type: short_text
key: custom.title
value: wool
- created_at: '2026-08-15T05:10:57.630Z'
- updated_at: '2026-08-15T05:10:57.630Z'
+ created_at: '2026-08-15T06:58:44.206Z'
+ updated_at: '2026-08-15T06:58:44.206Z'
storefront_visible: true
custom_field_definition_id: cfdef_UkLWZg9DAJ
patch:
@@ -15568,8 +15568,8 @@ paths:
field_type: short_text
key: custom.title
value: cotton
- created_at: '2026-08-15T05:10:57.697Z'
- updated_at: '2026-08-15T05:10:57.721Z'
+ created_at: '2026-08-15T06:58:44.269Z'
+ updated_at: '2026-08-15T06:58:44.286Z'
storefront_visible: true
custom_field_definition_id: cfdef_UkLWZg9DAJ
requestBody:
@@ -15688,9 +15688,10 @@ paths:
- key: description
type: html
source: |-
- Accusantium tempore ad magnam harum iusto aliquid consequuntur neque. Nesciunt recusandae impedit quia modi. Occaecati illo eveniet placeat possimus perferendis excepturi quaerat. Vitae aliquam quae cumque nostrum unde. Sequi aliquid cupiditate perferendis aperiam facilis beatae perspiciatis quibusdam.
- Sint rerum eaque voluptatum ut. Totam nihil inventore dolorem eius ratione asperiores. Molestiae beatae vel fugiat perspiciatis neque facilis hic animi.
- Numquam mollitia porro commodi necessitatibus saepe. Impedit autem in magni eum commodi. Tenetur voluptatum soluta odio voluptatibus. Sed quam quia reprehenderit maiores expedita accusantium. Perferendis doloremque consequatur esse ut.
+ In modi adipisci aspernatur assumenda commodi. Sequi molestias voluptatum at dolorem fuga quia. Animi iusto quisquam itaque eaque quas. Consequatur iste consequuntur explicabo hic perspiciatis commodi dolores.
+ Nobis tempora atque adipisci natus. Sapiente perferendis optio laborum eaque nam possimus cumque. Incidunt qui assumenda dicta voluptate modi. Suscipit cum dicta ex eaque quod. Iusto laboriosam impedit odit culpa nostrum atque.
+ Architecto molestias animi itaque exercitationem. Quasi ab laborum possimus dolorem accusamus. Mollitia explicabo repudiandae minus molestias. Atque aliquam saepe eligendi cum. A laboriosam unde esse minus magni adipisci.
+ Eius deleniti illo facilis sed soluta libero. Cumque architecto provident ab veniam. Atque nihil possimus optio doloremque distinctio.
- key: slug
type: string
source: espresso-machine
@@ -15801,8 +15802,8 @@ paths:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 767911
- slug: product-767911
+ name: Product 768575
+ slug: product-768575
meta_title:
meta_description:
meta_keywords:
@@ -15814,22 +15815,16 @@ paths:
in_stock: false
backorderable: true
available: true
- description: Quam temporibus explicabo officia fuga repudiandae
- quibusdam animi sint. Id suscipit incidunt quibusdam ipsum reiciendis.
- Natus ullam id neque sit eligendi quis laboriosam. Repellendus
- similique deleniti maiores nesciunt autem. Animi eius sed possimus
- quibusdam deleniti aperiam aspernatur consequuntur. Quam iure
- officia assumenda delectus. Veniam odit quis perspiciatis fugiat
- ipsam quaerat dolore. Sed voluptatibus laboriosam maiores quos
- occaecati. Occaecati esse nisi magnam temporibus laboriosam in.
- Quas deleniti sed qui totam tenetur sequi. Dolore voluptatum aliquid
- minima dolores hic fuga. Quis ratione accusamus a voluptatem facere.
- Necessitatibus ab nam ipsa cum at sunt itaque voluptas.
+ description: Cupiditate fugit nobis saepe non a. Vel quia ratione
+ dignissimos sapiente magni fugit perferendis. Sapiente magnam
+ nisi ullam consequuntur. Ut incidunt ab laboriosam omnis esse
+ dolor. Maiores beatae ad consequuntur consectetur quia molestiae
+ sunt. Ab adipisci magni repudiandae quibusdam numquam ratione.
+ Laudantium sit dolorem officia vero. Dolorem possimus perferendis
+ sunt vitae consectetur ab.
description_html: |-
- Quam temporibus explicabo officia fuga repudiandae quibusdam animi sint. Id suscipit incidunt quibusdam ipsum reiciendis. Natus ullam id neque sit eligendi quis laboriosam.
- Repellendus similique deleniti maiores nesciunt autem. Animi eius sed possimus quibusdam deleniti aperiam aspernatur consequuntur. Quam iure officia assumenda delectus.
- Veniam odit quis perspiciatis fugiat ipsam quaerat dolore. Sed voluptatibus laboriosam maiores quos occaecati. Occaecati esse nisi magnam temporibus laboriosam in.
- Quas deleniti sed qui totam tenetur sequi. Dolore voluptatum aliquid minima dolores hic fuga. Quis ratione accusamus a voluptatem facere. Necessitatibus ab nam ipsa cum at sunt itaque voluptas.
+ Cupiditate fugit nobis saepe non a. Vel quia ratione dignissimos sapiente magni fugit perferendis. Sapiente magnam nisi ullam consequuntur. Ut incidunt ab laboriosam omnis esse dolor.
+ Maiores beatae ad consequuntur consectetur quia molestiae sunt. Ab adipisci magni repudiandae quibusdam numquam ratione. Laudantium sit dolorem officia vero. Dolorem possimus perferendis sunt vitae consectetur ab.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -15844,14 +15839,14 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-08-15T05:10:57.909Z'
- updated_at: '2026-08-15T05:10:57.909Z'
+ created_at: '2026-08-15T06:58:44.577Z'
+ updated_at: '2026-08-15T06:58:44.577Z'
original_price:
status: active
metadata: {}
deleted_at:
- created_at: '2026-08-15T05:10:57.898Z'
- updated_at: '2026-08-15T05:10:57.917Z'
+ created_at: '2026-08-15T06:58:44.564Z'
+ updated_at: '2026-08-15T06:58:44.585Z'
delivery_profile_id: fp_UkLWZg9DAJ
product_type_id:
tax_category_id: taxcat_UkLWZg9DAJ
@@ -15989,8 +15984,8 @@ paths:
status: draft
metadata: {}
deleted_at:
- created_at: '2026-08-15T05:10:58.086Z'
- updated_at: '2026-08-15T05:10:58.092Z'
+ created_at: '2026-08-15T06:58:44.730Z'
+ updated_at: '2026-08-15T06:58:44.736Z'
delivery_profile_id: fp_UkLWZg9DAJ
product_type_id:
tax_category_id:
@@ -16197,8 +16192,8 @@ paths:
application/json:
example:
id: prod_UkLWZg9DAJ
- name: Product 809927
- slug: product-809927
+ name: Product 80456
+ slug: product-80456
meta_title:
meta_description:
meta_keywords:
@@ -16210,22 +16205,15 @@ paths:
in_stock: false
backorderable: true
available: true
- description: Quod rerum porro quidem quam labore illum molestiae aspernatur.
- Id quia reiciendis natus consequuntur. Maiores molestiae placeat
- quidem unde debitis minus excepturi. Expedita illo odio itaque quidem
- ratione eveniet harum accusamus. Harum voluptatibus quis explicabo
- expedita officiis minus at occaecati. Porro dolor eaque officia
- harum cupiditate. Ipsa numquam iure necessitatibus repudiandae natus.
- Odit possimus quis tempora eum ullam. Nisi temporibus quis veritatis
- incidunt quod saepe. Corrupti facere voluptatibus molestias repellat
- cum. Esse alias similique perspiciatis vero culpa ad aut. Veritatis
- porro aliquid aperiam soluta quam dolor. Impedit itaque molestiae
- quaerat eaque ex accusantium a.
+ description: Cum quod porro numquam reprehenderit. Magni aut quos
+ ea eum deleniti voluptas culpa. Sint asperiores eum aliquid cupiditate
+ tenetur impedit. Veritatis blanditiis modi itaque ut voluptatibus
+ totam voluptate ex. Quas similique ullam natus incidunt eos asperiores.
+ Tempore expedita at quidem libero rem. Eius quod reprehenderit sapiente
+ ducimus soluta illum repudiandae explicabo.
description_html: |-
- Quod rerum porro quidem quam labore illum molestiae aspernatur. Id quia reiciendis natus consequuntur. Maiores molestiae placeat quidem unde debitis minus excepturi.
- Expedita illo odio itaque quidem ratione eveniet harum accusamus. Harum voluptatibus quis explicabo expedita officiis minus at occaecati. Porro dolor eaque officia harum cupiditate.
- Ipsa numquam iure necessitatibus repudiandae natus. Odit possimus quis tempora eum ullam. Nisi temporibus quis veritatis incidunt quod saepe.
- Corrupti facere voluptatibus molestias repellat cum. Esse alias similique perspiciatis vero culpa ad aut. Veritatis porro aliquid aperiam soluta quam dolor. Impedit itaque molestiae quaerat eaque ex accusantium a.
+ Cum quod porro numquam reprehenderit. Magni aut quos ea eum deleniti voluptas culpa. Sint asperiores eum aliquid cupiditate tenetur impedit. Veritatis blanditiis modi itaque ut voluptatibus totam voluptate ex.
+ Quas similique ullam natus incidunt eos asperiores. Tempore expedita at quidem libero rem. Eius quod reprehenderit sapiente ducimus soluta illum repudiandae explicabo.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -16240,14 +16228,14 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-08-15T05:10:58.235Z'
- updated_at: '2026-08-15T05:10:58.235Z'
+ created_at: '2026-08-15T06:58:44.841Z'
+ updated_at: '2026-08-15T06:58:44.841Z'
original_price:
status: active
metadata: {}
deleted_at:
- created_at: '2026-08-15T05:10:58.223Z'
- updated_at: '2026-08-15T05:10:58.248Z'
+ created_at: '2026-08-15T06:58:44.832Z'
+ updated_at: '2026-08-15T06:58:44.849Z'
delivery_profile_id: fp_UkLWZg9DAJ
product_type_id:
tax_category_id: taxcat_UkLWZg9DAJ
@@ -16319,7 +16307,7 @@ paths:
example:
id: prod_UkLWZg9DAJ
name: Updated Name
- slug: product-82385
+ slug: product-824503
meta_title:
meta_description:
meta_keywords:
@@ -16331,31 +16319,21 @@ paths:
in_stock: false
backorderable: true
available: true
- description: Voluptatem culpa exercitationem accusamus officiis porro
- quaerat ad. Nisi sequi velit laudantium impedit officia accusantium
- ea nam. Cum laborum assumenda officiis incidunt. Nobis in repellendus
- non consequuntur cum eos sint. Ex velit officia illo fuga sint accusantium
- amet asperiores. Ex beatae excepturi veniam quas voluptatibus. Ducimus
- consequuntur dolore voluptates assumenda consectetur sed suscipit.
- Molestias fuga similique esse provident ullam ipsum. Reiciendis
- doloribus perferendis iusto facere sit mollitia error. Exercitationem
- neque est nobis natus nihil esse modi excepturi. Perspiciatis facilis
- eos id dolorum sit nulla soluta. Repudiandae nostrum hic architecto
- tempora doloribus. Voluptatem debitis possimus architecto quisquam
- rem expedita soluta. Voluptatibus culpa illo dolore ea ipsam. Recusandae
- laborum facere neque iure est vero molestiae occaecati. Provident
- optio ex assumenda minus eveniet perspiciatis molestiae. Doloremque
- enim suscipit aspernatur qui fuga. Sapiente possimus fugiat provident
- omnis blanditiis saepe. Excepturi nulla iste officiis enim mollitia.
- Quidem accusamus rerum autem molestias aliquid eligendi tenetur.
- Repellat exercitationem aliquid temporibus doloremque facilis incidunt.
- Nesciunt voluptate aliquid dignissimos necessitatibus.
+ description: Cumque commodi qui veniam assumenda voluptate facere
+ odit. Numquam maxime explicabo ipsa aliquam minus dolor voluptatum.
+ Harum totam debitis temporibus ad ratione reiciendis esse nisi.
+ Natus tempore neque similique nulla error in. Dolorem veniam animi
+ fugiat suscipit aperiam. Fugit qui dolor aut animi consectetur ab.
+ Quas assumenda adipisci corporis ut temporibus. Ipsam tenetur quo
+ id mollitia asperiores velit harum voluptatem. Fuga nisi ab minima
+ quisquam laboriosam at. Odio eum voluptates a repellendus beatae
+ accusantium suscipit. Officiis hic sunt quae voluptatem velit nobis.
+ Itaque repellendus error magnam ipsa deleniti. Laborum iste possimus
+ ratione illo quia. Dolores culpa ipsa vitae asperiores.
description_html: |-
- Voluptatem culpa exercitationem accusamus officiis porro quaerat ad. Nisi sequi velit laudantium impedit officia accusantium ea nam. Cum laborum assumenda officiis incidunt. Nobis in repellendus non consequuntur cum eos sint. Ex velit officia illo fuga sint accusantium amet asperiores.
- Ex beatae excepturi veniam quas voluptatibus. Ducimus consequuntur dolore voluptates assumenda consectetur sed suscipit. Molestias fuga similique esse provident ullam ipsum. Reiciendis doloribus perferendis iusto facere sit mollitia error. Exercitationem neque est nobis natus nihil esse modi excepturi.
- Perspiciatis facilis eos id dolorum sit nulla soluta. Repudiandae nostrum hic architecto tempora doloribus. Voluptatem debitis possimus architecto quisquam rem expedita soluta. Voluptatibus culpa illo dolore ea ipsam.
- Recusandae laborum facere neque iure est vero molestiae occaecati. Provident optio ex assumenda minus eveniet perspiciatis molestiae. Doloremque enim suscipit aspernatur qui fuga. Sapiente possimus fugiat provident omnis blanditiis saepe. Excepturi nulla iste officiis enim mollitia.
- Quidem accusamus rerum autem molestias aliquid eligendi tenetur. Repellat exercitationem aliquid temporibus doloremque facilis incidunt. Nesciunt voluptate aliquid dignissimos necessitatibus.
+ Cumque commodi qui veniam assumenda voluptate facere odit. Numquam maxime explicabo ipsa aliquam minus dolor voluptatum. Harum totam debitis temporibus ad ratione reiciendis esse nisi. Natus tempore neque similique nulla error in. Dolorem veniam animi fugiat suscipit aperiam.
+ Fugit qui dolor aut animi consectetur ab. Quas assumenda adipisci corporis ut temporibus. Ipsam tenetur quo id mollitia asperiores velit harum voluptatem. Fuga nisi ab minima quisquam laboriosam at.
+ Odio eum voluptates a repellendus beatae accusantium suscipit. Officiis hic sunt quae voluptatem velit nobis. Itaque repellendus error magnam ipsa deleniti. Laborum iste possimus ratione illo quia. Dolores culpa ipsa vitae asperiores.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -16370,14 +16348,14 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-08-15T05:10:58.393Z'
- updated_at: '2026-08-15T05:10:58.393Z'
+ created_at: '2026-08-15T06:58:44.984Z'
+ updated_at: '2026-08-15T06:58:44.984Z'
original_price:
status: active
metadata: {}
deleted_at:
- created_at: '2026-08-15T05:10:58.382Z'
- updated_at: '2026-08-15T05:10:58.423Z'
+ created_at: '2026-08-15T06:58:44.972Z'
+ updated_at: '2026-08-15T06:58:45.019Z'
delivery_profile_id: fp_UkLWZg9DAJ
product_type_id:
tax_category_id: taxcat_UkLWZg9DAJ
@@ -17322,15 +17300,15 @@ paths:
- id: coupon_UkLWZg9DAJ
code: AAA111
state: unused
- created_at: '2026-08-15T05:10:41.888Z'
- updated_at: '2026-08-15T05:10:41.888Z'
+ created_at: '2026-08-15T06:58:31.156Z'
+ updated_at: '2026-08-15T06:58:31.156Z'
promotion_id: promo_UkLWZg9DAJ
order_id:
- id: coupon_gbHJdmfrXB
code: BBB222
state: unused
- created_at: '2026-08-15T05:10:41.890Z'
- updated_at: '2026-08-15T05:10:41.890Z'
+ created_at: '2026-08-15T06:58:31.157Z'
+ updated_at: '2026-08-15T06:58:31.157Z'
promotion_id: promo_UkLWZg9DAJ
order_id:
meta:
@@ -17392,8 +17370,8 @@ paths:
example:
data:
- id: pact_UkLWZg9DAJ
- created_at: '2026-08-15T05:10:59.729Z'
- updated_at: '2026-08-15T05:10:59.729Z'
+ created_at: '2026-08-15T06:58:46.247Z'
+ updated_at: '2026-08-15T06:58:46.247Z'
type: free_shipping
promotion_id: promo_UkLWZg9DAJ
preferences: {}
@@ -17457,8 +17435,8 @@ paths:
application/json:
example:
id: pact_UkLWZg9DAJ
- created_at: '2026-08-15T05:10:59.768Z'
- updated_at: '2026-08-15T05:10:59.768Z'
+ created_at: '2026-08-15T06:58:46.324Z'
+ updated_at: '2026-08-15T06:58:46.324Z'
type: free_shipping
promotion_id: promo_UkLWZg9DAJ
preferences: {}
@@ -17586,8 +17564,8 @@ paths:
example:
data:
- id: prorule_UkLWZg9DAJ
- created_at: '2026-08-15T05:10:59.825Z'
- updated_at: '2026-08-15T05:10:59.825Z'
+ created_at: '2026-08-15T06:58:46.422Z'
+ updated_at: '2026-08-15T06:58:46.422Z'
type: currency
promotion_id: promo_UkLWZg9DAJ
preferences:
@@ -17657,8 +17635,8 @@ paths:
application/json:
example:
id: prorule_UkLWZg9DAJ
- created_at: '2026-08-15T05:10:59.863Z'
- updated_at: '2026-08-15T05:10:59.863Z'
+ created_at: '2026-08-15T06:58:46.462Z'
+ updated_at: '2026-08-15T06:58:46.462Z'
type: currency
promotion_id: promo_UkLWZg9DAJ
preferences:
@@ -17749,8 +17727,8 @@ paths:
application/json:
example:
id: prorule_UkLWZg9DAJ
- created_at: '2026-08-15T05:10:59.890Z'
- updated_at: '2026-08-15T05:10:59.904Z'
+ created_at: '2026-08-15T06:58:46.496Z'
+ updated_at: '2026-08-15T06:58:46.512Z'
type: currency
promotion_id: promo_UkLWZg9DAJ
preferences:
@@ -17858,7 +17836,7 @@ paths:
name: Summer Sale
description:
code: summer
- starts_at: '2026-08-15T05:10:59.935Z'
+ starts_at: '2026-08-15T06:58:46.545Z'
expires_at:
usage_limit:
match_policy: all
@@ -17869,8 +17847,8 @@ paths:
code_prefix:
promotion_category_id:
metadata: {}
- created_at: '2026-08-15T05:10:59.935Z'
- updated_at: '2026-08-15T05:10:59.935Z'
+ created_at: '2026-08-15T06:58:46.545Z'
+ updated_at: '2026-08-15T06:58:46.545Z'
action_ids: []
rule_ids: []
meta:
@@ -17977,7 +17955,7 @@ paths:
name: Black Friday
description:
code: blackfriday-os
- starts_at: '2026-08-15T05:11:00.085Z'
+ starts_at: '2026-08-15T06:58:46.668Z'
expires_at:
usage_limit:
match_policy: all
@@ -17988,8 +17966,8 @@ paths:
code_prefix:
promotion_category_id:
metadata: {}
- created_at: '2026-08-15T05:11:00.086Z'
- updated_at: '2026-08-15T05:11:00.109Z'
+ created_at: '2026-08-15T06:58:46.668Z'
+ updated_at: '2026-08-15T06:58:46.688Z'
action_ids:
- pact_UkLWZg9DAJ
- pact_gbHJdmfrXB
@@ -18155,7 +18133,7 @@ paths:
name: Summer Sale
description:
code: summer
- starts_at: '2026-08-15T05:11:00.147Z'
+ starts_at: '2026-08-15T06:58:46.726Z'
expires_at:
usage_limit:
match_policy: all
@@ -18166,8 +18144,8 @@ paths:
code_prefix:
promotion_category_id:
metadata: {}
- created_at: '2026-08-15T05:11:00.148Z'
- updated_at: '2026-08-15T05:11:00.148Z'
+ created_at: '2026-08-15T06:58:46.726Z'
+ updated_at: '2026-08-15T06:58:46.726Z'
action_ids: []
rule_ids: []
patch:
@@ -18264,7 +18242,7 @@ paths:
name: Summer Sale
description:
code: summer
- starts_at: '2026-08-15T05:11:00.246Z'
+ starts_at: '2026-08-15T06:58:46.835Z'
expires_at:
usage_limit:
match_policy: all
@@ -18275,8 +18253,8 @@ paths:
code_prefix:
promotion_category_id:
metadata: {}
- created_at: '2026-08-15T05:11:00.247Z'
- updated_at: '2026-08-15T05:11:00.264Z'
+ created_at: '2026-08-15T06:58:46.835Z'
+ updated_at: '2026-08-15T06:58:46.852Z'
action_ids: []
rule_ids: []
requestBody:
@@ -18538,15 +18516,15 @@ paths:
label: Country
description:
preference_schema:
+ - key: country_codes
+ type: array
+ default: []
- key: country_id
type: integer
default:
- - key: country_iso
+ - key: country_code
type: string
default:
- - key: country_isos
- type: array
- default: []
- type: currency
label: Currency
description:
@@ -18604,12 +18582,12 @@ paths:
label: Option Value(s)
description:
preference_schema:
- - key: match_policy
- type: string
- default: any
- key: eligible_values
type: array
default: []
+ - key: match_policy
+ type: string
+ default: any
- type: product
label: Product(s)
description:
@@ -18748,15 +18726,15 @@ paths:
application/json:
example:
id: re_UkLWZg9DAJ
- transaction_id: BGS-ae88abaeb0c7
+ transaction_id: BGS-593f8c773ee8
amount: '5.0'
payment_id: py_UkLWZg9DAJ
refund_reason_id: rr_UkLWZg9DAJ
originator_id:
originator_type:
metadata: {}
- created_at: '2026-08-15T05:10:52.479Z'
- updated_at: '2026-08-15T05:10:52.479Z'
+ created_at: '2026-08-15T06:58:40.295Z'
+ updated_at: '2026-08-15T06:58:40.295Z'
requestBody:
content:
application/json:
@@ -18900,8 +18878,8 @@ paths:
data:
- id: sccat_UkLWZg9DAJ
name: Goodwill
- created_at: '2026-08-15T05:11:00.768Z'
- updated_at: '2026-08-15T05:11:00.768Z'
+ created_at: '2026-08-15T06:58:47.345Z'
+ updated_at: '2026-08-15T06:58:47.345Z'
non_expiring: false
meta:
page: 1
@@ -18995,8 +18973,8 @@ paths:
example:
id: sccat_UkLWZg9DAJ
name: Goodwill
- created_at: '2026-08-15T05:11:00.805Z'
- updated_at: '2026-08-15T05:11:00.805Z'
+ created_at: '2026-08-15T06:58:47.378Z'
+ updated_at: '2026-08-15T06:58:47.378Z'
non_expiring: false
schema:
"$ref": "#/components/schemas/StoreCreditCategory"
@@ -19090,8 +19068,8 @@ paths:
preferred_order_number_prefix: R
preferred_order_number_suffix: ''
preferred_order_number_sequence_start: 1001
- created_at: '2026-08-15T05:10:38.570Z'
- updated_at: '2026-08-15T05:11:00.878Z'
+ created_at: '2026-08-15T06:58:28.064Z'
+ updated_at: '2026-08-15T06:58:47.432Z'
order_number_sequence_started: false
url: http://www.example.com:3000
api_url: http://www.example.com:3000
@@ -19406,8 +19384,8 @@ paths:
preferred_order_number_prefix: R
preferred_order_number_suffix: ''
preferred_order_number_sequence_start: 1001
- created_at: '2026-08-15T05:10:38.570Z'
- updated_at: '2026-08-15T05:11:01.057Z'
+ created_at: '2026-08-15T06:58:28.064Z'
+ updated_at: '2026-08-15T06:58:47.521Z'
order_number_sequence_started: false
url: http://www.example.com:3000
api_url: http://www.example.com:3000
@@ -19804,18 +19782,18 @@ paths:
example:
data:
- id: tax_UkLWZg9DAJ
- name: TaxRate - 397557
+ name: TaxRate - 563669
included_in_price: true
show_rate_in_label: true
metadata: {}
- created_at: '2026-08-15T05:11:01.164Z'
- updated_at: '2026-08-15T05:11:01.164Z'
+ created_at: '2026-08-15T06:58:47.622Z'
+ updated_at: '2026-08-15T06:58:47.622Z'
deleted_at:
amount: '0.19'
amount_percentage: 19.0
tax_category_id: taxcat_UkLWZg9DAJ
store_id: store_UkLWZg9DAJ
- country_iso: DE
+ country_code: DE
state_code:
meta:
page: 1
@@ -19860,7 +19838,7 @@ paths:
Creates a tax rate for the current store. Give either `amount` as a
decimal (`0.19`) or `amount_percentage` as a percentage (`19`).
- Name the jurisdiction with `country_iso` (and `state_code` for a
+ Name the jurisdiction with `country_code` (and `state_code` for a
state-level rate). Omitting the country makes the rate apply everywhere.
Set `included_in_price` for VAT-style pricing, where the rate is backed
@@ -19891,14 +19869,14 @@ paths:
included_in_price: true
show_rate_in_label: true
metadata: {}
- created_at: '2026-08-15T05:11:01.226Z'
- updated_at: '2026-08-15T05:11:01.226Z'
+ created_at: '2026-08-15T06:58:47.683Z'
+ updated_at: '2026-08-15T06:58:47.683Z'
deleted_at:
amount: '0.19'
amount_percentage: 19.0
tax_category_id: taxcat_UkLWZg9DAJ
store_id: store_UkLWZg9DAJ
- country_iso: DE
+ country_code: DE
state_code:
schema:
"$ref": "#/components/schemas/TaxRate"
@@ -19938,7 +19916,7 @@ paths:
type: boolean
tax_category_id:
type: string
- country_iso:
+ country_code:
type: string
description: ISO code, e.g. "DE". Omit for every country.
state_code:
@@ -19983,18 +19961,18 @@ paths:
application/json:
example:
id: tax_UkLWZg9DAJ
- name: TaxRate - 891272
+ name: TaxRate - 184154
included_in_price: true
show_rate_in_label: true
metadata: {}
- created_at: '2026-08-15T05:11:01.265Z'
- updated_at: '2026-08-15T05:11:01.265Z'
+ created_at: '2026-08-15T06:58:47.767Z'
+ updated_at: '2026-08-15T06:58:47.767Z'
deleted_at:
amount: '0.19'
amount_percentage: 19.0
tax_category_id: taxcat_UkLWZg9DAJ
store_id: store_UkLWZg9DAJ
- country_iso: DE
+ country_code: DE
state_code:
schema:
"$ref": "#/components/schemas/TaxRate"
@@ -20025,18 +20003,18 @@ paths:
application/json:
example:
id: tax_UkLWZg9DAJ
- name: TaxRate - 172348
+ name: TaxRate - 842363
included_in_price: true
show_rate_in_label: true
metadata: {}
- created_at: '2026-08-15T05:11:01.293Z'
- updated_at: '2026-08-15T05:11:01.311Z'
+ created_at: '2026-08-15T06:58:47.837Z'
+ updated_at: '2026-08-15T06:58:47.867Z'
deleted_at:
amount: '0.07'
amount_percentage: 7.0
tax_category_id: taxcat_UkLWZg9DAJ
store_id: store_UkLWZg9DAJ
- country_iso: DE
+ country_code: DE
state_code:
schema:
"$ref": "#/components/schemas/TaxRate"
@@ -20058,7 +20036,7 @@ paths:
type: boolean
tax_category_id:
type: string
- country_iso:
+ country_code:
type: string
state_code:
type: string
@@ -20336,13 +20314,13 @@ paths:
example:
data:
- id: adm_UkLWZg9DAJ
- first_name: Delta
- last_name: Leffler
- full_name: Delta Leffler
+ first_name: Alonzo
+ last_name: Botsford
+ full_name: Alonzo Botsford
selected_locale:
- created_at: '2026-08-15T05:10:38.669Z'
- updated_at: '2026-08-15T05:10:38.669Z'
+ created_at: '2026-08-15T06:58:28.183Z'
+ updated_at: '2026-08-15T06:58:28.183Z'
avatar_url:
roles:
- id: role_UkLWZg9DAJ
@@ -20408,13 +20386,13 @@ paths:
application/json:
example:
id: adm_UkLWZg9DAJ
- first_name: Zandra
- last_name: Wisoky
- full_name: Zandra Wisoky
+ first_name: Scotty
+ last_name: O'Hara
+ full_name: Scotty O'Hara
selected_locale:
- created_at: '2026-08-15T05:10:38.859Z'
- updated_at: '2026-08-15T05:10:38.859Z'
+ created_at: '2026-08-15T06:58:28.320Z'
+ updated_at: '2026-08-15T06:58:28.320Z'
avatar_url:
roles:
- id: role_UkLWZg9DAJ
@@ -20475,13 +20453,13 @@ paths:
application/json:
example:
id: adm_UkLWZg9DAJ
first_name: Renamed
- last_name: Miller
- full_name: Renamed Miller
+ last_name: Flatley
+ full_name: Renamed Flatley
selected_locale:
- created_at: '2026-08-15T05:10:38.884Z'
- updated_at: '2026-08-15T05:10:38.897Z'
+ created_at: '2026-08-15T06:58:28.341Z'
+ updated_at: '2026-08-15T06:58:28.354Z'
avatar_url:
roles:
- id: role_UkLWZg9DAJ
@@ -20597,15 +20575,15 @@ paths:
example:
data:
- id: inv_UkLWZg9DAJ
status: pending
- created_at: '2026-08-15T05:10:44.889Z'
- updated_at: '2026-08-15T05:10:44.889Z'
- expires_at: '2026-08-29T05:10:44.886Z'
+ created_at: '2026-08-15T06:58:33.962Z'
+ updated_at: '2026-08-15T06:58:33.962Z'
+ expires_at: '2026-08-29T06:58:33.959Z'
role_id: role_UkLWZg9DAJ
role_name: admin
- inviter_email: [email protected]
- acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=e3sKSN6MrUEcqei6QN7aCWUS"
+ inviter_email: [email protected]
+ acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=5ehVHcJSMcs5RqgksW9WHsvv"
invitee_exists: false
store:
id: store_UkLWZg9DAJ
@@ -20669,13 +20647,13 @@ paths:
id: inv_gbHJdmfrXB
status: pending
- created_at: '2026-08-15T05:10:44.926Z'
- updated_at: '2026-08-15T05:10:44.926Z'
- expires_at: '2026-08-29T05:10:44.923Z'
+ created_at: '2026-08-15T06:58:33.995Z'
+ updated_at: '2026-08-15T06:58:33.995Z'
+ expires_at: '2026-08-29T06:58:33.992Z'
role_id: role_UkLWZg9DAJ
role_name: admin
- inviter_email: [email protected]
- acceptance_url: "/accept-invitation/inv_gbHJdmfrXB?token=sYqXDtW28BZP46LSdnpDm7RE"
+ inviter_email: [email protected]
+ acceptance_url: "/accept-invitation/inv_gbHJdmfrXB?token=7628NwuzKVvWy9xdwCarCT6G"
invitee_exists: false
store:
id: store_UkLWZg9DAJ
@@ -20788,15 +20766,15 @@ paths:
application/json:
example:
id: inv_UkLWZg9DAJ
status: pending
- created_at: '2026-08-15T05:10:44.967Z'
- updated_at: '2026-08-15T05:10:44.967Z'
- expires_at: '2026-08-29T05:10:44.964Z'
+ created_at: '2026-08-15T06:58:34.032Z'
+ updated_at: '2026-08-15T06:58:34.032Z'
+ expires_at: '2026-08-29T06:58:34.030Z'
role_id: role_UkLWZg9DAJ
role_name: admin
- inviter_email: [email protected]
- acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=DPnCPszwBcLdg57JyyBZ97oF"
+ inviter_email: [email protected]
+ acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=CvCpwRYnevBZVwHB9uzz2Ji4"
invitee_exists: false
store:
id: store_UkLWZg9DAJ
@@ -21141,8 +21119,8 @@ paths:
- id: role_UkLWZg9DAJ
name: admin
description:
- created_at: '2026-08-15T05:11:00.367Z'
- updated_at: '2026-08-15T05:11:00.367Z'
+ created_at: '2026-08-15T06:58:46.949Z'
+ updated_at: '2026-08-15T06:58:46.949Z'
permissions:
- read_orders
- write_orders
@@ -21242,8 +21220,8 @@ paths:
id: role_gbHJdmfrXB
name: order_manager
description: Handles daily orders
- created_at: '2026-08-15T05:11:00.403Z'
- updated_at: '2026-08-15T05:11:00.403Z'
+ created_at: '2026-08-15T06:58:46.985Z'
+ updated_at: '2026-08-15T06:58:46.985Z'
permissions:
- write_orders
- read_customers
@@ -21337,8 +21315,8 @@ paths:
id: role_gbHJdmfrXB
name: support
description:
- created_at: '2026-08-15T05:11:00.429Z'
- updated_at: '2026-08-15T05:11:00.442Z'
+ created_at: '2026-08-15T06:58:47.010Z'
+ updated_at: '2026-08-15T06:58:47.024Z'
permissions:
- read_orders
- read_customers
@@ -21516,7 +21494,7 @@ paths:
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
- country_iso: US
+ country_code: US
country_name: United States
state_code: AL
state_text: AL
@@ -21534,8 +21512,8 @@ paths:
kind: warehouse
pickup_enabled: false
pickup_stock_policy: local
- created_at: '2026-08-15T05:11:00.541Z'
- updated_at: '2026-08-15T05:11:00.541Z'
+ created_at: '2026-08-15T06:58:47.114Z'
+ updated_at: '2026-08-15T06:58:47.114Z'
meta:
page: 1
limit: 25
@@ -21597,7 +21575,7 @@ paths:
const stockLocation = await client.stockLocations.create({
name: 'Brooklyn warehouse',
kind: 'warehouse',
- country_iso: 'US',
+ country_code: 'US',
state_code: 'NY',
city: 'Brooklyn',
zipcode: '11201',
@@ -21607,7 +21585,7 @@ paths:
})
- lang: bash
label: Spree CLI
- source: spree api post /stock_locations -d '{"name":"Brooklyn warehouse","kind":"warehouse","country_iso":"US","state_code":"NY","city":"Brooklyn","zipcode":"11201","pickup_enabled":true,"pickup_stock_policy":"local","pickup_ready_in_minutes":60}'
+ source: spree api post /stock_locations -d '{"name":"Brooklyn warehouse","kind":"warehouse","country_code":"US","state_code":"NY","city":"Brooklyn","zipcode":"11201","pickup_enabled":true,"pickup_stock_policy":"local","pickup_ready_in_minutes":60}'
parameters:
- name: x-spree-api-key
in: header
@@ -21631,7 +21609,7 @@ paths:
address1:
city:
zipcode:
- country_iso:
+ country_code:
country_name:
state_code:
state_text:
@@ -21649,8 +21627,8 @@ paths:
kind: store
pickup_enabled: true
pickup_stock_policy: local
- created_at: '2026-08-15T05:11:00.594Z'
- updated_at: '2026-08-15T05:11:00.594Z'
+ created_at: '2026-08-15T06:58:47.165Z'
+ updated_at: '2026-08-15T06:58:47.165Z'
schema:
"$ref": "#/components/schemas/StockLocation"
'422':
@@ -21715,7 +21693,7 @@ paths:
company:
type: string
nullable: true
- country_iso:
+ country_code:
type: string
nullable: true
description: ISO-3166 alpha-2 country code (e.g. "US").
@@ -21809,7 +21787,7 @@ paths:
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
- country_iso: US
+ country_code: US
country_name: United States
state_code: AL
state_text: AL
@@ -21827,8 +21805,8 @@ paths:
kind: warehouse
pickup_enabled: false
pickup_stock_policy: local
- created_at: '2026-08-15T05:11:00.627Z'
- updated_at: '2026-08-15T05:11:00.627Z'
+ created_at: '2026-08-15T06:58:47.214Z'
+ updated_at: '2026-08-15T06:58:47.214Z'
schema:
"$ref": "#/components/schemas/StockLocation"
'404':
@@ -21899,7 +21877,7 @@ paths:
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
- country_iso: US
+ country_code: US
country_name: United States
state_code: AL
state_text: AL
@@ -21917,8 +21895,8 @@ paths:
kind: warehouse
pickup_enabled: true
pickup_stock_policy: local
- created_at: '2026-08-15T05:11:00.670Z'
- updated_at: '2026-08-15T05:11:00.693Z'
+ created_at: '2026-08-15T06:58:47.270Z'
+ updated_at: '2026-08-15T06:58:47.287Z'
schema:
"$ref": "#/components/schemas/StockLocation"
'422':
@@ -21977,7 +21955,7 @@ paths:
company:
type: string
nullable: true
- country_iso:
+ country_code:
type: string
nullable: true
state_code:
@@ -22161,14 +22139,14 @@ paths:
dimensions_unit:
backorder_limit:
deleted_at:
- created_at: '2026-08-15T05:11:01.450Z'
- updated_at: '2026-08-15T05:11:01.462Z'
+ created_at: '2026-08-15T06:58:48.014Z'
+ updated_at: '2026-08-15T06:58:48.024Z'
preorderable: false
tax_category_id: taxcat_UkLWZg9DAJ
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 1011350
+ product_name: Product 1011489
- id: variant_gbHJdmfrXB
product_id: prod_UkLWZg9DAJ
sku: SKU-121
@@ -22181,10 +22159,10 @@ paths:
in_stock: false
backorderable: true
preorder: false
- weight: 187.28
- height: 196.3
- width: 195.59
- depth: 140.1
+ weight: 90.34
+ height: 27.1
+ width: 51.7
+ depth: 6.0
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -22207,8 +22185,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-08-15T05:11:01.485Z'
- updated_at: '2026-08-15T05:11:01.485Z'
+ created_at: '2026-08-15T06:58:48.041Z'
+ updated_at: '2026-08-15T06:58:48.041Z'
metadata: {}
position: 2
cost_price: '17.0'
@@ -22218,14 +22196,14 @@ paths:
dimensions_unit:
backorder_limit:
deleted_at:
- created_at: '2026-08-15T05:11:01.481Z'
- updated_at: '2026-08-15T05:11:01.495Z'
+ created_at: '2026-08-15T06:58:48.038Z'
+ updated_at: '2026-08-15T06:58:48.049Z'
preorderable: false
tax_category_id: taxcat_UkLWZg9DAJ
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 1011350
+ product_name: Product 1011489
meta:
page: 1
limit: 25
@@ -22339,8 +22317,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-08-15T05:11:01.607Z'
- updated_at: '2026-08-15T05:11:01.607Z'
+ created_at: '2026-08-15T06:58:48.158Z'
+ updated_at: '2026-08-15T06:58:48.158Z'
metadata: {}
position: 3
cost_price:
@@ -22350,14 +22328,14 @@ paths:
dimensions_unit:
backorder_limit:
deleted_at:
- created_at: '2026-08-15T05:11:01.611Z'
- updated_at: '2026-08-15T05:11:01.613Z'
+ created_at: '2026-08-15T06:58:48.162Z'
+ updated_at: '2026-08-15T06:58:48.164Z'
preorderable: false
tax_category_id: taxcat_UkLWZg9DAJ
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 1025718
+ product_name: Product 1025132
'422':
description: validation error
content:
@@ -22544,10 +22522,10 @@ paths:
in_stock: false
backorderable: true
preorder: false
- weight: 31.7
- height: 125.22
- width: 188.56
- depth: 28.78
+ weight: 2.54
+ height: 44.43
+ width: 13.0
+ depth: 187.15
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -22570,8 +22548,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-08-15T05:11:01.765Z'
- updated_at: '2026-08-15T05:11:01.765Z'
+ created_at: '2026-08-15T06:58:48.313Z'
+ updated_at: '2026-08-15T06:58:48.313Z'
metadata: {}
position: 2
cost_price: '17.0'
@@ -22581,14 +22559,14 @@ paths:
dimensions_unit:
backorder_limit:
deleted_at:
- created_at: '2026-08-15T05:11:01.762Z'
- updated_at: '2026-08-15T05:11:01.773Z'
+ created_at: '2026-08-15T06:58:48.310Z'
+ updated_at: '2026-08-15T06:58:48.321Z'
preorderable: false
tax_category_id: taxcat_UkLWZg9DAJ
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 10452
+ product_name: Product 1043301
'404':
description: variant not found
content:
@@ -22672,10 +22650,10 @@ paths:
in_stock: false
backorderable: true
preorder: false
- weight: 8.41
- height: 63.21
- width: 7.46
- depth: 98.65
+ weight: 132.31
+ height: 176.4
+ width: 193.39
+ depth: 188.59
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -22698,8 +22676,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-08-15T05:11:01.930Z'
- updated_at: '2026-08-15T05:11:01.930Z'
+ created_at: '2026-08-15T06:58:48.485Z'
+ updated_at: '2026-08-15T06:58:48.485Z'
metadata: {}
position: 2
cost_price: '17.0'
@@ -22709,14 +22687,14 @@ paths:
dimensions_unit:
backorder_limit:
deleted_at:
- created_at: '2026-08-15T05:11:01.928Z'
- updated_at: '2026-08-15T05:11:01.959Z'
+ created_at: '2026-08-15T06:58:48.482Z'
+ updated_at: '2026-08-15T06:58:48.519Z'
preorderable: false
tax_category_id: taxcat_UkLWZg9DAJ
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 1061461
+ product_name: Product 1065267
requestBody:
content:
application/json:
@@ -22961,9 +22939,9 @@ paths:
request_errors:
response_body:
success: false
- created_at: '2026-08-15T05:11:02.120Z'
- updated_at: '2026-08-15T05:11:02.120Z'
- delivered_at: '2026-08-15T05:11:02.120Z'
+ created_at: '2026-08-15T06:58:48.659Z'
+ updated_at: '2026-08-15T06:58:48.659Z'
+ delivered_at: '2026-08-15T06:58:48.659Z'
payload:
event: order.created
data:
@@ -22979,9 +22957,9 @@ paths:
request_errors:
response_body:
success: true
- created_at: '2026-08-15T05:11:02.119Z'
- updated_at: '2026-08-15T05:11:02.119Z'
- delivered_at: '2026-08-15T05:11:02.119Z'
+ created_at: '2026-08-15T06:58:48.659Z'
+ updated_at: '2026-08-15T06:58:48.659Z'
+ delivered_at: '2026-08-15T06:58:48.658Z'
payload:
event: order.created
data:
@@ -23084,9 +23062,9 @@ paths:
request_errors:
response_body:
success: false
- created_at: '2026-08-15T05:11:02.212Z'
- updated_at: '2026-08-15T05:11:02.212Z'
- delivered_at: '2026-08-15T05:11:02.212Z'
+ created_at: '2026-08-15T06:58:48.749Z'
+ updated_at: '2026-08-15T06:58:48.749Z'
+ delivered_at: '2026-08-15T06:58:48.749Z'
payload:
event: order.created
data:
@@ -23175,8 +23153,8 @@ paths:
request_errors:
response_body:
success:
- created_at: '2026-08-15T05:11:02.377Z'
- updated_at: '2026-08-15T05:11:02.377Z'
+ created_at: '2026-08-15T06:58:48.852Z'
+ updated_at: '2026-08-15T06:58:48.852Z'
delivered_at:
payload:
event: order.created
@@ -23279,8 +23257,8 @@ paths:
- order.completed
- product.created
disabled_reason:
- created_at: '2026-08-15T05:11:02.405Z'
- updated_at: '2026-08-15T05:11:02.405Z'
+ created_at: '2026-08-15T06:58:48.883Z'
+ updated_at: '2026-08-15T06:58:48.883Z'
disabled_at:
secret_key:
last_delivery_at:
@@ -23375,10 +23353,10 @@ paths:
subscriptions:
- order.placed
disabled_reason:
- created_at: '2026-08-15T05:11:02.525Z'
- updated_at: '2026-08-15T05:11:02.525Z'
+ created_at: '2026-08-15T06:58:48.989Z'
+ updated_at: '2026-08-15T06:58:48.989Z'
disabled_at:
- secret_key: 62d096533c60e1bf61c26ed641efc7da5d2a0d67e70ceaebae0d4978ac0bb595
+ secret_key: 6c8d37ccadaa6d2542cb94d6d4cb7980ac575f2b847b69582f402d4787d3f881
last_delivery_at:
recent_delivery_count: 0
recent_failure_count: 0
@@ -23501,8 +23479,8 @@ paths:
- order.completed
- product.created
disabled_reason:
- created_at: '2026-08-15T05:11:02.630Z'
- updated_at: '2026-08-15T05:11:02.630Z'
+ created_at: '2026-08-15T06:58:49.064Z'
+ updated_at: '2026-08-15T06:58:49.064Z'
disabled_at:
secret_key:
last_delivery_at:
@@ -23581,8 +23559,8 @@ paths:
- order.completed
- product.created
disabled_reason:
- created_at: '2026-08-15T05:11:02.718Z'
- updated_at: '2026-08-15T05:11:02.736Z'
+ created_at: '2026-08-15T06:58:49.152Z'
+ updated_at: '2026-08-15T06:58:49.169Z'
disabled_at:
secret_key:
last_delivery_at:
@@ -23739,13 +23717,13 @@ paths:
request_errors:
response_body:
success:
- created_at: '2026-08-15T05:11:02.951Z'
- updated_at: '2026-08-15T05:11:02.951Z'
+ created_at: '2026-08-15T06:58:49.311Z'
+ updated_at: '2026-08-15T06:58:49.311Z'
delivered_at:
payload:
- id: 4e8d80f5-681c-4fd9-992a-097441263087
+ id: e2262ebb-6bf2-4753-b0f9-6f1cf0ffaa80
name: webhook.test
- created_at: '2026-08-15T05:11:02Z'
+ created_at: '2026-08-15T06:58:49Z'
data:
message: This is a test webhook from Spree.
metadata:
@@ -23814,8 +23792,8 @@ paths:
- order.completed
- product.created
disabled_reason:
- created_at: '2026-08-15T05:11:03.024Z'
- updated_at: '2026-08-15T05:11:03.041Z'
+ created_at: '2026-08-15T06:58:49.338Z'
+ updated_at: '2026-08-15T06:58:49.353Z'
disabled_at:
secret_key:
last_delivery_at:
@@ -23892,9 +23870,9 @@ paths:
- order.completed
- product.created
disabled_reason: Investigating
- created_at: '2026-08-15T05:11:03.071Z'
- updated_at: '2026-08-15T05:11:03.086Z'
- disabled_at: '2026-08-15T05:11:03.085Z'
+ created_at: '2026-08-15T06:58:49.395Z'
+ updated_at: '2026-08-15T06:58:49.409Z'
+ disabled_at: '2026-08-15T06:58:49.409Z'
secret_key:
last_delivery_at:
recent_delivery_count: 0
@@ -23977,8 +23955,8 @@ paths:
automatic: false
rules_match_policy: all
metadata: {}
- created_at: '2026-08-15T05:10:40.578Z'
- updated_at: '2026-08-15T05:10:40.578Z'
+ created_at: '2026-08-15T06:58:29.868Z'
+ updated_at: '2026-08-15T06:58:29.868Z'
meta:
page: 1
limit: 25
@@ -24046,8 +24024,8 @@ paths:
automatic: true
rules_match_policy: any
metadata: {}
- created_at: '2026-08-15T05:10:40.697Z'
- updated_at: '2026-08-15T05:10:40.698Z'
+ created_at: '2026-08-15T06:58:29.917Z'
+ updated_at: '2026-08-15T06:58:29.919Z'
schema:
"$ref": "#/components/schemas/Collection"
'422':
@@ -24174,8 +24152,8 @@ paths:
automatic: false
rules_match_policy: all
metadata: {}
- created_at: '2026-08-15T05:10:40.747Z'
- updated_at: '2026-08-15T05:10:40.747Z'
+ created_at: '2026-08-15T06:58:29.978Z'
+ updated_at: '2026-08-15T06:58:29.978Z'
schema:
"$ref": "#/components/schemas/Collection"
'404':
@@ -24239,8 +24217,8 @@ paths:
automatic: false
rules_match_policy: all
metadata: {}
- created_at: '2026-08-15T05:10:40.799Z'
- updated_at: '2026-08-15T05:10:40.821Z'
+ created_at: '2026-08-15T06:58:30.045Z'
+ updated_at: '2026-08-15T06:58:30.062Z'
schema:
"$ref": "#/components/schemas/Collection"
requestBody:
@@ -24415,8 +24393,8 @@ paths:
application/json:
example:
id: prod_UkLWZg9DAJ
- name: Product 63819
- slug: product-63819
+ name: Product 65220
+ slug: product-65220
meta_title:
meta_description:
meta_keywords:
@@ -24428,23 +24406,28 @@ paths:
in_stock: false
backorderable: true
available: true
- description: Corrupti commodi sunt nisi rerum aperiam. Accusamus eligendi
- a dignissimos atque qui similique commodi nisi. Tempore exercitationem
- nemo mollitia laboriosam beatae. Debitis numquam fugiat magnam ducimus
- eos nisi. Occaecati alias necessitatibus nihil enim. Non saepe ipsa
- perspiciatis illum esse. Delectus totam est accusamus ex odit officia
- magnam dolores. Voluptatem commodi tenetur voluptatibus eligendi.
- Esse ipsam repudiandae sapiente atque ipsum. Necessitatibus placeat
- fugit blanditiis harum dolorem molestias facilis. Officiis iusto
- doloremque corporis molestiae ad voluptatem odio. Modi excepturi
- quam porro hic corrupti dolore. Magni explicabo facilis odio magnam
- possimus. Temporibus in repellat possimus nesciunt maiores libero
- blanditiis.
+ description: Aspernatur fuga qui quaerat incidunt. Soluta deleniti
+ perspiciatis quisquam quidem a est. Voluptatem quibusdam sed culpa
+ deserunt a harum. Minus voluptatibus ipsam at itaque expedita. Rerum
+ nesciunt adipisci ea non illum corrupti deleniti in. Tempora nisi
+ cumque asperiores adipisci veritatis repellendus. Voluptatem velit
+ natus non maiores necessitatibus fugiat praesentium cumque. Placeat
+ hic repudiandae consectetur suscipit iure. Quia aliquam iusto voluptate
+ quos corrupti. Autem exercitationem ratione iusto quos. Ipsam ullam
+ asperiores magni et officia. Soluta dolorum inventore provident
+ ipsa. Amet nobis harum dolorum sint vitae. Dolorum laborum ad veritatis
+ corrupti quo. Hic earum sed reprehenderit at libero et dignissimos.
+ Esse maxime tempore dolorem officiis. Adipisci similique aperiam
+ quos esse facilis veniam porro in. Nam voluptate iusto expedita
+ laboriosam aut consequuntur soluta voluptatem. Perspiciatis tempore
+ fugiat veritatis itaque. At amet facilis ullam adipisci. Modi aliquid
+ unde exercitationem adipisci illum laboriosam.
description_html: |-
- Corrupti commodi sunt nisi rerum aperiam. Accusamus eligendi a dignissimos atque qui similique commodi nisi. Tempore exercitationem nemo mollitia laboriosam beatae.
- Debitis numquam fugiat magnam ducimus eos nisi. Occaecati alias necessitatibus nihil enim. Non saepe ipsa perspiciatis illum esse.
- Delectus totam est accusamus ex odit officia magnam dolores. Voluptatem commodi tenetur voluptatibus eligendi. Esse ipsam repudiandae sapiente atque ipsum.
- Necessitatibus placeat fugit blanditiis harum dolorem molestias facilis. Officiis iusto doloremque corporis molestiae ad voluptatem odio. Modi excepturi quam porro hic corrupti dolore. Magni explicabo facilis odio magnam possimus. Temporibus in repellat possimus nesciunt maiores libero blanditiis.
+ Aspernatur fuga qui quaerat incidunt. Soluta deleniti perspiciatis quisquam quidem a est. Voluptatem quibusdam sed culpa deserunt a harum.
+ Minus voluptatibus ipsam at itaque expedita. Rerum nesciunt adipisci ea non illum corrupti deleniti in. Tempora nisi cumque asperiores adipisci veritatis repellendus. Voluptatem velit natus non maiores necessitatibus fugiat praesentium cumque. Placeat hic repudiandae consectetur suscipit iure.
+ Quia aliquam iusto voluptate quos corrupti. Autem exercitationem ratione iusto quos. Ipsam ullam asperiores magni et officia. Soluta dolorum inventore provident ipsa.
+ Amet nobis harum dolorum sint vitae. Dolorum laborum ad veritatis corrupti quo. Hic earum sed reprehenderit at libero et dignissimos. Esse maxime tempore dolorem officiis. Adipisci similique aperiam quos esse facilis veniam porro in.
+ Nam voluptate iusto expedita laboriosam aut consequuntur soluta voluptatem. Perspiciatis tempore fugiat veritatis itaque. At amet facilis ullam adipisci. Modi aliquid unde exercitationem adipisci illum laboriosam.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -24459,14 +24442,14 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-08-15T05:10:40.913Z'
- updated_at: '2026-08-15T05:10:40.913Z'
+ created_at: '2026-08-15T06:58:30.159Z'
+ updated_at: '2026-08-15T06:58:30.159Z'
original_price:
status: active
metadata: {}
deleted_at:
- created_at: '2026-08-15T05:10:40.901Z'
- updated_at: '2026-08-15T05:10:40.921Z'
+ created_at: '2026-08-15T06:58:30.147Z'
+ updated_at: '2026-08-15T06:58:30.168Z'
delivery_profile_id: fp_UkLWZg9DAJ
product_type_id:
tax_category_id: taxcat_UkLWZg9DAJ
@@ -24669,8 +24652,8 @@ paths:
name: Berlin
external_id:
metadata: {}
- created_at: '2026-08-15T05:10:41.135Z'
- updated_at: '2026-08-15T05:10:41.135Z'
+ created_at: '2026-08-15T06:58:30.459Z'
+ updated_at: '2026-08-15T06:58:30.459Z'
company_id: comp_UkLWZg9DAJ
contacts_count: 0
billing_address:
@@ -24715,14 +24698,14 @@ paths:
address1: 'Hafenstr 1',
city: 'Hamburg',
postal_code: '20095',
- country_iso: 'DE',
+ country_code: 'DE',
},
})
- lang: bash
label: Spree CLI
source: spree api post /companies/{company_id}/locations -d '{"name":"Hamburg
warehouse","billing_address":{"first_name":"Anna","last_name":"Muller","address1":"Hafenstr
- 1","city":"Hamburg","postal_code":"20095","country_iso":"DE"}}'
+ 1","city":"Hamburg","postal_code":"20095","country_code":"DE"}}'
parameters:
- name: x-spree-api-key
in: header
@@ -24749,8 +24732,8 @@ paths:
name: Hamburg warehouse
external_id:
metadata: {}
- created_at: '2026-08-15T05:10:41.176Z'
- updated_at: '2026-08-15T05:10:41.176Z'
+ created_at: '2026-08-15T06:58:30.507Z'
+ updated_at: '2026-08-15T06:58:30.507Z'
company_id: comp_UkLWZg9DAJ
contacts_count: 0
billing_address:
@@ -24765,18 +24748,19 @@ paths:
phone:
company:
country_name: Germany
- country_iso: DE
+ country_code: DE
state_text:
state_code:
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr:
+ country_iso: DE
state_name:
label:
metadata: {}
- created_at: '2026-08-15T05:10:41.176Z'
- updated_at: '2026-08-15T05:10:41.176Z'
+ created_at: '2026-08-15T06:58:30.506Z'
+ updated_at: '2026-08-15T06:58:30.506Z'
customer_id:
shipping_address:
'422':
@@ -24817,7 +24801,7 @@ paths:
type: string
postal_code:
type: string
- country_iso:
+ country_code:
type: string
example: DE
required:
@@ -24875,8 +24859,8 @@ paths:
name: Berlin
external_id:
metadata: {}
- created_at: '2026-08-15T05:10:41.204Z'
- updated_at: '2026-08-15T05:10:41.204Z'
+ created_at: '2026-08-15T06:58:30.537Z'
+ updated_at: '2026-08-15T06:58:30.537Z'
company_id: comp_UkLWZg9DAJ
contacts_count: 0
billing_address:
@@ -24922,8 +24906,8 @@ paths:
name: Berlin Mitte
external_id:
metadata: {}
- created_at: '2026-08-15T05:10:41.226Z'
- updated_at: '2026-08-15T05:10:41.247Z'
+ created_at: '2026-08-15T06:58:30.558Z'
+ updated_at: '2026-08-15T06:58:30.572Z'
company_id: comp_UkLWZg9DAJ
contacts_count: 0
billing_address:
@@ -25038,10 +25022,10 @@ paths:
issued_at:
expires_at:
verified_at:
- created_at: '2026-08-15T05:10:41.288Z'
- updated_at: '2026-08-15T05:10:41.288Z'
+ created_at: '2026-08-15T06:58:30.603Z'
+ updated_at: '2026-08-15T06:58:30.603Z'
company_id: comp_UkLWZg9DAJ
- country_iso:
+ country_code:
state_code:
active: false
lapsed: false
@@ -25070,7 +25054,7 @@ paths:
Records exemption evidence against a business. Certificates start `pending` and exempt nothing
until verified.
- `country_iso` and `state_code` say where the certificate holds — omit both for one valid
+ `country_code` and `state_code` say where the certificate holds — omit both for one valid
everywhere, give only the country for one valid throughout it. `document` takes an ActiveStorage
signed blob id obtained from `POST /api/v3/admin/direct_uploads`.
@@ -25100,7 +25084,7 @@ paths:
const certificate = await client.companies.taxExemptionCertificates.create('comp_UkLWZg9DAJ', {
certificate_number: 'DE-RESALE-7',
reason_code: 'resale',
- country_iso: 'DE',
+ country_code: 'DE',
document: signed_id,
})
- lang: bash
@@ -25123,10 +25107,10 @@ paths:
issued_at:
expires_at:
verified_at:
- created_at: '2026-08-15T05:10:41.338Z'
- updated_at: '2026-08-15T05:10:41.340Z'
+ created_at: '2026-08-15T06:58:30.651Z'
+ updated_at: '2026-08-15T06:58:30.652Z'
company_id: comp_UkLWZg9DAJ
- country_iso: DE
+ country_code: DE
state_code:
active: false
lapsed: false
@@ -25158,7 +25142,7 @@ paths:
type: string
description: Becomes the tax provider's entity use code.
example: resale
- country_iso:
+ country_code:
type: string
nullable: true
example: DE
@@ -25253,11 +25237,11 @@ paths:
metadata: {}
issued_at:
expires_at:
- verified_at: '2026-08-15T05:10:41.417Z'
- created_at: '2026-08-15T05:10:41.402Z'
- updated_at: '2026-08-15T05:10:41.417Z'
+ verified_at: '2026-08-15T06:58:30.730Z'
+ created_at: '2026-08-15T06:58:30.714Z'
+ updated_at: '2026-08-15T06:58:30.730Z'
company_id: comp_UkLWZg9DAJ
- country_iso:
+ country_code:
state_code:
active: true
lapsed: false
@@ -25333,11 +25317,11 @@ paths:
metadata: {}
issued_at:
expires_at:
- verified_at: '2026-08-15T05:10:41.426Z'
- created_at: '2026-08-15T05:10:41.426Z'
- updated_at: '2026-08-15T05:10:41.440Z'
+ verified_at: '2026-08-15T06:58:30.739Z'
+ created_at: '2026-08-15T06:58:30.739Z'
+ updated_at: '2026-08-15T06:58:30.756Z'
company_id: comp_UkLWZg9DAJ
- country_iso:
+ country_code:
state_code:
active: false
lapsed: false
@@ -25453,8 +25437,8 @@ paths:
validation_evidence:
source:
validated_at:
- created_at: '2026-08-15T05:10:41.506Z'
- updated_at: '2026-08-15T05:10:41.506Z'
+ created_at: '2026-08-15T06:58:30.838Z'
+ updated_at: '2026-08-15T06:58:30.838Z'
validatable: false
customer_id:
cart_id:
@@ -25516,8 +25500,8 @@ paths:
validation_evidence:
source:
validated_at:
- created_at: '2026-08-15T05:10:41.550Z'
- updated_at: '2026-08-15T05:10:41.550Z'
+ created_at: '2026-08-15T06:58:30.886Z'
+ updated_at: '2026-08-15T06:58:30.886Z'
validatable: false
customer_id:
cart_id:
@@ -25664,8 +25648,8 @@ paths:
name: Acme Industrial
external_id: ACME-1
metadata: {}
- created_at: '2026-08-15T05:10:41.612Z'
- updated_at: '2026-08-15T05:10:41.612Z'
+ created_at: '2026-08-15T06:58:30.938Z'
+ updated_at: '2026-08-15T06:58:30.938Z'
locations_count: 0
meta:
page: 1
@@ -25727,8 +25711,8 @@ paths:
name: Globex Corporation
external_id: GLBX-42
metadata: {}
- created_at: '2026-08-15T05:10:41.650Z'
- updated_at: '2026-08-15T05:10:41.650Z'
+ created_at: '2026-08-15T06:58:30.972Z'
+ updated_at: '2026-08-15T06:58:30.972Z'
locations_count: 0
'422':
description: invalid request
@@ -25810,8 +25794,8 @@ paths:
data:
- id: cc_UkLWZg9DAJ
role: buyer
- created_at: '2026-08-15T05:10:41.687Z'
- updated_at: '2026-08-15T05:10:41.687Z'
+ created_at: '2026-08-15T06:58:31.011Z'
+ updated_at: '2026-08-15T06:58:31.011Z'
company_location_id: cloc_UkLWZg9DAJ
customer_id: cust_UkLWZg9DAJ
@@ -25867,11 +25851,11 @@ paths:
example:
id: cc_gbHJdmfrXB
role: admin
- created_at: '2026-08-15T05:10:41.740Z'
- updated_at: '2026-08-15T05:10:41.740Z'
+ created_at: '2026-08-15T06:58:31.061Z'
+ updated_at: '2026-08-15T06:58:31.061Z'
company_location_id: cloc_UkLWZg9DAJ
customer_id: cust_gbHJdmfrXB
'422':
description: invalid request
content:
@@ -25946,8 +25930,8 @@ paths:
example:
id: cc_UkLWZg9DAJ
role: buyer
- created_at: '2026-08-15T05:10:41.780Z'
- updated_at: '2026-08-15T05:10:41.780Z'
+ created_at: '2026-08-15T06:58:31.100Z'
+ updated_at: '2026-08-15T06:58:31.100Z'
company_location_id: cloc_UkLWZg9DAJ
customer_id: cust_UkLWZg9DAJ
@@ -26030,8 +26014,8 @@ paths:
name: General
default: true
position: 1
- created_at: '2026-08-15T05:10:38.634Z'
- updated_at: '2026-08-15T05:10:38.634Z'
+ created_at: '2026-08-15T06:58:28.146Z'
+ updated_at: '2026-08-15T06:58:28.146Z'
kind: shipping
digital: false
offers_pickup: false
@@ -26102,11 +26086,11 @@ paths:
application/json:
example:
id: fp_gbHJdmfrXB
- name: Oversized 1786770643.181406
+ name: Oversized 1786777112.4575481
default: false
position: 2
- created_at: '2026-08-15T05:10:43.189Z'
- updated_at: '2026-08-15T05:10:43.189Z'
+ created_at: '2026-08-15T06:58:32.461Z'
+ updated_at: '2026-08-15T06:58:32.461Z'
kind: shipping
digital: false
offers_pickup: false
@@ -26210,8 +26194,8 @@ paths:
id: og_EfhxLZ9ck8
name: EU warehouse
position: 2
- created_at: '2026-08-15T05:10:43.305Z'
- updated_at: '2026-08-15T05:10:43.305Z'
+ created_at: '2026-08-15T06:58:32.510Z'
+ updated_at: '2026-08-15T06:58:32.510Z'
delivery_profile_id: fp_gbHJdmfrXB
stock_location_ids:
- sloc_UkLWZg9DAJ
@@ -26286,11 +26270,11 @@ paths:
application/json:
example:
id: fp_gbHJdmfrXB
- name: Bulky 1786770643.3224561
+ name: Bulky 1786777112.518354
default: false
position: 2
- created_at: '2026-08-15T05:10:43.323Z'
- updated_at: '2026-08-15T05:10:43.323Z'
+ created_at: '2026-08-15T06:58:32.519Z'
+ updated_at: '2026-08-15T06:58:32.519Z'
kind: shipping
digital: false
offers_pickup: false
@@ -26421,8 +26405,8 @@ paths:
tracking_url:
markup_flat: '0.0'
markup_percent: '0.0'
- created_at: '2026-08-15T05:10:43.393Z'
- updated_at: '2026-08-15T05:10:43.394Z'
+ created_at: '2026-08-15T06:58:32.592Z'
+ updated_at: '2026-08-15T06:58:32.593Z'
deleted_at:
services: []
rules: []
@@ -26510,8 +26494,8 @@ paths:
tracking_url:
markup_flat: '0.0'
markup_percent: '0.0'
- created_at: '2026-08-15T05:10:43.440Z'
- updated_at: '2026-08-15T05:10:43.441Z'
+ created_at: '2026-08-15T06:58:32.640Z'
+ updated_at: '2026-08-15T06:58:32.641Z'
deleted_at:
services: []
rules: []
@@ -26718,13 +26702,13 @@ paths:
const deliveryZone = await client.deliveryZones.create({
name: 'US North-East',
members: [
- { member_type: 'country', country_iso: 'US' },
- { member_type: 'postal_code', country_iso: 'US', postal_code_prefix: '10' },
+ { member_type: 'country', country_code: 'US' },
+ { member_type: 'postal_code', country_code: 'US', postal_code_prefix: '10' },
],
})
- lang: bash
label: Spree CLI
- source: spree api post /delivery_zones -d '{"name":"US North-East","members":[{"member_type":"country","country_iso":"US"},{"member_type":"postal_code","country_iso":"US","postal_code_prefix":"10"}]}'
+ source: spree api post /delivery_zones -d '{"name":"US North-East","members":[{"member_type":"country","country_code":"US"},{"member_type":"postal_code","country_code":"US","postal_code_prefix":"10"}]}'
parameters:
- name: x-spree-api-key
in: header
@@ -26754,28 +26738,28 @@ paths:
members:
- id: dzm_UkLWZg9DAJ
member_type: country
- country_iso: US
+ country_code: US
state_code:
postal_code_prefix:
postal_code_from:
postal_code_to:
country_name: United States
state_name:
- created_at: '2026-08-15T05:10:43.517Z'
- updated_at: '2026-08-15T05:10:43.517Z'
+ created_at: '2026-08-15T06:58:32.714Z'
+ updated_at: '2026-08-15T06:58:32.714Z'
- id: dzm_gbHJdmfrXB
member_type: postal_code
- country_iso: US
+ country_code: US
state_code:
postal_code_prefix: '10'
postal_code_from:
postal_code_to:
country_name: United States
state_name:
- created_at: '2026-08-15T05:10:43.518Z'
- updated_at: '2026-08-15T05:10:43.518Z'
- created_at: '2026-08-15T05:10:43.517Z'
- updated_at: '2026-08-15T05:10:43.517Z'
+ created_at: '2026-08-15T06:58:32.714Z'
+ updated_at: '2026-08-15T06:58:32.714Z'
+ created_at: '2026-08-15T06:58:32.713Z'
+ updated_at: '2026-08-15T06:58:32.713Z'
delivery_profile_id: fp_UkLWZg9DAJ
delivery_origin_group_id: og_UkLWZg9DAJ
delivery_method_ids: []
@@ -26802,7 +26786,7 @@ paths:
- country
- state
- postal_code
- country_iso:
+ country_code:
type: string
nullable: true
example: US
@@ -26870,20 +26854,20 @@ paths:
- id: int_UkLWZg9DAJ
name: Carrier
active: false
- created_at: '2026-08-15T05:10:44.735Z'
- updated_at: '2026-08-15T05:10:44.735Z'
+ created_at: '2026-08-15T06:58:33.862Z'
+ updated_at: '2026-08-15T06:58:33.862Z'
type: carrier
group: shipping
preferences:
- account_number: '42'
api_key: "•••••cret"
+ account_number: '42'
preference_schema:
- - key: account_number
- type: string
- default:
- key: api_key
type: password
default:
+ - key: account_number
+ type: string
+ default:
meta:
page: 1
limit: 25
@@ -26943,20 +26927,20 @@ paths:
id: int_UkLWZg9DAJ
name: Carrier
active: false
- created_at: '2026-08-15T05:10:44.823Z'
- updated_at: '2026-08-15T05:10:44.823Z'
+ created_at: '2026-08-15T06:58:33.903Z'
+ updated_at: '2026-08-15T06:58:33.903Z'
type: carrier
group: shipping
preferences:
- account_number:
api_key: "•••••cret"
+ account_number:
preference_schema:
- - key: account_number
- type: string
- default:
- key: api_key
type: password
default:
+ - key: account_number
+ type: string
+ default:
requestBody:
content:
application/json:
@@ -27028,12 +27012,12 @@ paths:
description:
logo_url:
preference_schema:
- - key: account_number
- type: string
- default:
- key: api_key
type: password
default:
+ - key: account_number
+ type: string
+ default:
"/api/v3/admin/integrations/{id}/test":
post:
summary: Test integration connection
@@ -27136,8 +27120,8 @@ paths:
- id: pt_UkLWZg9DAJ
name: T-Shirt
products_count: 0
- created_at: '2026-08-15T05:10:56.900Z'
- updated_at: '2026-08-15T05:10:56.900Z'
+ created_at: '2026-08-15T06:58:43.728Z'
+ updated_at: '2026-08-15T06:58:43.728Z'
delivery_profile_id:
option_type_ids: []
category_ids: []
@@ -27212,8 +27196,8 @@ paths:
id: pt_gbHJdmfrXB
name: Hoodie
products_count: 0
- created_at: '2026-08-15T05:10:56.970Z'
- updated_at: '2026-08-15T05:10:56.970Z'
+ created_at: '2026-08-15T06:58:43.783Z'
+ updated_at: '2026-08-15T06:58:43.783Z'
delivery_profile_id:
option_type_ids: []
category_ids: []
@@ -27313,8 +27297,8 @@ paths:
id: pt_UkLWZg9DAJ
name: T-Shirt
products_count: 0
- created_at: '2026-08-15T05:10:57.011Z'
- updated_at: '2026-08-15T05:10:57.011Z'
+ created_at: '2026-08-15T06:58:43.831Z'
+ updated_at: '2026-08-15T06:58:43.831Z'
delivery_profile_id:
option_type_ids: []
category_ids: []
@@ -27367,8 +27351,8 @@ paths:
id: pt_UkLWZg9DAJ
name: Premium T-Shirt
products_count: 0
- created_at: '2026-08-15T05:10:57.080Z'
- updated_at: '2026-08-15T05:10:57.100Z'
+ created_at: '2026-08-15T06:58:43.884Z'
+ updated_at: '2026-08-15T06:58:43.901Z'
delivery_profile_id:
option_type_ids: []
category_ids: []
@@ -27913,7 +27897,7 @@ components:
nullable: true
country_name:
type: string
- country_iso:
+ country_code:
type: string
state_text:
type: string
@@ -27930,6 +27914,8 @@ components:
state_abbr:
type: string
nullable: true
+ country_iso:
+ type: string
state_name:
type: string
nullable: true
@@ -27957,13 +27943,14 @@ components:
- phone
- company
- country_name
- - country_iso
+ - country_code
- state_text
- state_code
- quick_checkout
- is_default_billing
- is_default_shipping
- state_abbr
+ - country_iso
- state_name
- label
- metadata
@@ -29481,7 +29468,7 @@ components:
type: string
member_type:
type: string
- country_iso:
+ country_code:
type: string
nullable: true
state_code:
@@ -29509,7 +29496,7 @@ components:
required:
- id
- member_type
- - country_iso
+ - country_code
- state_code
- postal_code_prefix
- postal_code_from
@@ -30506,7 +30493,7 @@ components:
type: boolean
default:
type: boolean
- country_isos:
+ country_codes:
type: array
items:
type: string
@@ -30532,7 +30519,7 @@ components:
- default_locale
- tax_inclusive
- default
- - country_isos
+ - country_codes
- supported_locales
- tax_provider
- created_at
@@ -32227,7 +32214,7 @@ components:
zipcode:
type: string
nullable: true
- country_iso:
+ country_code:
type: string
nullable: true
country_name:
@@ -32284,7 +32271,7 @@ components:
- address1
- city
- zipcode
- - country_iso
+ - country_code
- country_name
- state_code
- state_text
@@ -32674,7 +32661,7 @@ components:
type: string
company_id:
type: string
- country_iso:
+ country_code:
type: string
nullable: true
state_code:
@@ -32708,7 +32695,7 @@ components:
- created_at
- updated_at
- company_id
- - country_iso
+ - country_code
- state_code
- active
- lapsed
@@ -32804,7 +32791,7 @@ components:
taxability_reason:
type: string
nullable: true
- country_iso:
+ country_code:
type: string
nullable: true
state_code:
@@ -32831,7 +32818,7 @@ components:
- provider_id
- metadata
- taxability_reason
- - country_iso
+ - country_code
- state_code
- data
- created_at
@@ -32869,7 +32856,7 @@ components:
store_id:
type: string
nullable: true
- country_iso:
+ country_code:
type: string
nullable: true
state_code:
@@ -32888,7 +32875,7 @@ components:
- amount_percentage
- tax_category_id
- store_id
- - country_iso
+ - country_code
- state_code
x-typelizer: true
Variant:
diff --git a/docs/api-reference/store.yaml b/docs/api-reference/store.yaml
index 63f3964030..572c0e7e40 100644
--- a/docs/api-reference/store.yaml
+++ b/docs/api-reference/store.yaml
@@ -87,16 +87,16 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjEwMTQ5YzFlLTNmNDktNGMwNS1iYWRhLTcxOWQzYmUzMjRkNiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2Nzc0MjYzfQ.GodWnOC1B49J1QLrADDppMnF_Gb-ebVVUP8wACUFWTU
- refresh_token: J7bR24aJesc7prwwhJ7uayFr
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjYxMGJlZDY4LWU0ZDgtNDY0My1iMmFjLTc3YTg4YjY5NWExYiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2NzgwNzI5fQ._sANbjDpQTbLDGcp6Y8T5gVSi-BUWaFjuLNUnjtZC_Y
+ refresh_token: GJGcToDQ4J2tbweZsA17jm58
user:
id: cust_UkLWZg9DAJ
- first_name: Savannah
+ first_name: Patrica
last_name: Fahey
phone:
accepts_email_marketing: false
- full_name: Savannah Fahey
+ full_name: Patrica Fahey
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
addresses: []
@@ -194,16 +194,16 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImExOGU0NGJiLWE1MDYtNDJjYy04ZDM3LTdmYTk5ZDY5M2QxNyIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2Nzc0MjYzfQ.Wx_68tWuvpzQ0FA9JWaQHvbclNZD0nowmhpv4oRtflA
- refresh_token: cVKQBHjgYvgPMsE8d1XYCyty
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImM0MjI1YzA1LTlhMTQtNDhjZi04YjEzLTZhZjhiZTJhODFkZiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2NzgwNzI5fQ.ncEG7M6stkHtmnyQUOlVp8i_LB_F4hAx4ihR9PUAHKQ
+ refresh_token: My5m7fesMJp5LZqKoTfMfR4y
user:
id: cust_UkLWZg9DAJ
- first_name: Maurita
- last_name: Bailey
+ first_name: Rosena
+ last_name: Hettinger
phone:
accepts_email_marketing: false
- full_name: Maurita Bailey
+ full_name: Rosena Hettinger
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
addresses: []
@@ -393,16 +393,16 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImFjOTMxZjA0LTg5NWMtNGI3Ni1hMjgzLTIwYjAzZTQwOTIwOSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2Nzc0MjY4fQ.kbC3GhnovC918pYZlZpgdrgCPZPibg4V7MgmvTyFhEc
- refresh_token: rWag3bWJA6pCx1hVuNTAPiYb
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjAzODlhZmQ1LTMxMTgtNGM0My1iYmFhLWQzYTUzMmQxODYxMiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2NzgwNzMzfQ.sDpzaC8rD1PIw86hca_ay43vMkEN6ZYz_HnHEcMuuLA
+ refresh_token: LR96Zupa3EwiZtZhDQbd5Kxz
user:
id: cust_UkLWZg9DAJ
- first_name: Ayana
- last_name: Dooley
+ first_name: Kimberlee
+ last_name: Berge
phone:
accepts_email_marketing: false
- full_name: Ayana Dooley
+ full_name: Kimberlee Berge
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
addresses: []
@@ -879,8 +879,8 @@ paths:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 1347577
- slug: product-1347577
+ name: Product 1344
+ slug: product-1344
meta_title:
meta_description:
meta_keywords:
@@ -892,21 +892,23 @@ paths:
in_stock: false
backorderable: true
available: true
- description: Velit quia neque tempora saepe. Ratione perspiciatis
- quidem blanditiis facere nostrum molestias recusandae corporis.
- Et inventore iste possimus dolor assumenda facilis sed perferendis.
- Distinctio accusamus neque ducimus id. Rem omnis possimus sequi
- id eius non repudiandae. Tempore provident ducimus impedit ex
- beatae sequi. Accusantium rem aliquid quibusdam saepe quis odio
- recusandae. Quod explicabo consequuntur praesentium assumenda
- sapiente voluptates quam eum. Commodi cumque occaecati eveniet
- delectus earum ratione esse. Ipsum pariatur ducimus delectus eligendi
- maiores facilis nostrum. Voluptatem quo assumenda in iusto nulla
- nesciunt necessitatibus nostrum.
+ description: Deserunt minima dicta praesentium repudiandae maxime
+ beatae qui cumque. Facere enim eaque maxime rerum. Vel ipsa quos
+ nam modi. Eaque perspiciatis repellat officiis commodi illo optio
+ in. Sed necessitatibus similique atque aliquid explicabo saepe
+ debitis fugit. A labore consectetur quaerat distinctio ex. Adipisci
+ eius laudantium quam ipsam aut vero. Vero perspiciatis nulla amet
+ iure mollitia perferendis magni assumenda. Assumenda quisquam
+ necessitatibus voluptatibus iure asperiores animi mollitia. Inventore
+ suscipit error blanditiis incidunt. Sint beatae doloremque ut
+ architecto laboriosam. Facilis neque ut suscipit perspiciatis.
+ Quas nisi iure earum illum. Atque natus ut mollitia saepe occaecati
+ aperiam ab in.
description_html: |-
- Velit quia neque tempora saepe. Ratione perspiciatis quidem blanditiis facere nostrum molestias recusandae corporis. Et inventore iste possimus dolor assumenda facilis sed perferendis.
- Distinctio accusamus neque ducimus id. Rem omnis possimus sequi id eius non repudiandae. Tempore provident ducimus impedit ex beatae sequi. Accusantium rem aliquid quibusdam saepe quis odio recusandae. Quod explicabo consequuntur praesentium assumenda sapiente voluptates quam eum.
- Commodi cumque occaecati eveniet delectus earum ratione esse. Ipsum pariatur ducimus delectus eligendi maiores facilis nostrum. Voluptatem quo assumenda in iusto nulla nesciunt necessitatibus nostrum.
+ Deserunt minima dicta praesentium repudiandae maxime beatae qui cumque. Facere enim eaque maxime rerum. Vel ipsa quos nam modi.
+ Eaque perspiciatis repellat officiis commodi illo optio in. Sed necessitatibus similique atque aliquid explicabo saepe debitis fugit. A labore consectetur quaerat distinctio ex.
+ Adipisci eius laudantium quam ipsam aut vero. Vero perspiciatis nulla amet iure mollitia perferendis magni assumenda. Assumenda quisquam necessitatibus voluptatibus iure asperiores animi mollitia. Inventore suscipit error blanditiis incidunt. Sint beatae doloremque ut architecto laboriosam.
+ Facilis neque ut suscipit perspiciatis. Quas nisi iure earum illum. Atque natus ut mollitia saepe occaecati aperiam ab in.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -1061,8 +1063,8 @@ paths:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 1799946
- slug: product-1799946
+ name: Product 1798980
+ slug: product-1798980
meta_title:
meta_description:
meta_keywords:
@@ -1091,8 +1093,8 @@ paths:
price_list_id:
original_price:
- id: prod_gbHJdmfrXB
- name: Product 1805127
- slug: product-1805127
+ name: Product 1807883
+ slug: product-1807883
meta_title:
meta_description:
meta_keywords:
@@ -1104,20 +1106,14 @@ paths:
in_stock: false
backorderable: true
available: true
- description: Temporibus eos sunt molestiae ab. Iure eos laboriosam
- tempore porro eius. Qui perspiciatis numquam reprehenderit molestias
- unde accusantium autem. Iure quas maxime atque culpa consequatur
- consectetur laborum adipisci. Nulla temporibus ullam suscipit
- illo ea. Optio exercitationem distinctio excepturi officia minima
- nemo ab. Nemo veniam nulla amet voluptatem iusto. Quas saepe cum
- vitae impedit eos. Alias eligendi quos dolorum accusamus quo nulla
- dolores maxime. Autem laborum eaque corporis error facilis. Ab
- omnis impedit libero saepe at modi deserunt. Unde laboriosam pariatur
- quaerat nemo.
- description_html: |-
- Temporibus eos sunt molestiae ab. Iure eos laboriosam tempore porro eius. Qui perspiciatis numquam reprehenderit molestias unde accusantium autem.
- Iure quas maxime atque culpa consequatur consectetur laborum adipisci. Nulla temporibus ullam suscipit illo ea. Optio exercitationem distinctio excepturi officia minima nemo ab. Nemo veniam nulla amet voluptatem iusto.
- Quas saepe cum vitae impedit eos. Alias eligendi quos dolorum accusamus quo nulla dolores maxime. Autem laborum eaque corporis error facilis. Ab omnis impedit libero saepe at modi deserunt. Unde laboriosam pariatur quaerat nemo.
+ description: Inventore laborum aspernatur officiis impedit ipsa
+ optio sit beatae. Dolorem laborum deserunt sit accusantium culpa
+ magnam laboriosam fuga. Officia pariatur temporibus amet minima
+ numquam sapiente sed.
+ description_html: Inventore laborum aspernatur officiis impedit
+ ipsa optio sit beatae. Dolorem laborum deserunt sit accusantium
+ culpa magnam laboriosam fuga. Officia pariatur temporibus amet
+ minima numquam sapiente sed.
default_variant_id: variant_EfhxLZ9ck8
thumbnail_url:
tags: []
@@ -1219,8 +1215,8 @@ paths:
application/json:
example:
id: prod_UkLWZg9DAJ
- name: Product 207405
- slug: product-207405
+ name: Product 207961
+ slug: product-207961
meta_title:
meta_description:
meta_keywords:
@@ -1254,7 +1250,7 @@ paths:
amount_in_cents: 999
currency: USD
display_amount: "$9.99"
- recorded_at: '2026-07-31T05:11:17Z'
+ recorded_at: '2026-07-31T06:59:02Z'
schema:
"$ref": "#/components/schemas/Product"
'404':
@@ -1504,7 +1500,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_gbHJdmfrXB
- token: NTBsegXH2GZj3pSYkgm2feg2
+ token: nMM4hK2cBpC5bcxn17eCDC4E
email:
customer_note:
currency: USD
@@ -1563,8 +1559,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1096481
- slug: product-1096481
+ name: Product 1098909
+ slug: product-1098909
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -1600,7 +1596,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -1609,7 +1605,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: 7wVULFGt35ViAJgZNnt3TRJR
+ token: qJc6nPebysuz7wYWmKnMrtk9
email:
customer_note:
currency: USD
@@ -1668,8 +1664,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1086182
- slug: product-1086182
+ name: Product 108320
+ slug: product-108320
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -1705,7 +1701,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -1787,7 +1783,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: ZoNUnEV7SfRVDP4K1SR8m2N2
+ token: ZoBNKJfCnTWRc1a39eFXVB4j
email:
customer_note:
currency: USD
@@ -1845,7 +1841,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -1952,7 +1948,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: 9YaNTnZP6WsUV5EQaz3tH7tS
+ token: 33ibYah7Ew4wcQba25e6BhHS
email:
customer_note:
currency: USD
@@ -1960,7 +1956,7 @@ paths:
total_quantity: 0
warnings:
- code: line_item_removed
- message: Product 113360 was removed because it was sold out
+ message: Product 1138056 was removed because it was sold out
line_item_id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
coupon_code:
@@ -2014,7 +2010,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -2058,7 +2054,7 @@ paths:
address1: '123 Main St',
city: 'New York',
postal_code: '10001',
- country_iso: 'US',
+ country_code: 'US',
state_abbr: 'NY',
},
}, {
@@ -2102,7 +2098,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: jT1CyJeuQJRHTwDxv2HKBTh7
+ token: cekvvTmkvdfAQUcZf4pt3ATK
email:
customer_note: Leave at door
currency: USD
@@ -2157,8 +2153,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1146731
- slug: product-1146731
+ name: Product 1146888
+ slug: product-1146888
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -2194,7 +2190,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -2243,7 +2239,7 @@ paths:
type: string
company:
type: string
- country_iso:
+ country_code:
type: string
state_code:
type: string
@@ -2266,7 +2262,7 @@ paths:
type: string
company:
type: string
- country_iso:
+ country_code:
type: string
state_code:
type: string
@@ -2377,8 +2373,8 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: fr8DnknLS93spy291U2AhNE9
+ token: ofju3DCyNTVHt9D41Zff7mSH
customer_note:
currency: USD
locale: en
@@ -2429,8 +2425,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1166147
- slug: product-1166147
+ name: Product 1165794
+ slug: product-1165794
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -2467,13 +2463,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: true
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
shipping_address:
id: addr_UkLWZg9DAJ
@@ -2487,13 +2484,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: true
state_abbr: NY
+ country_iso: US
state_name: New York
payment_methods: []
gift_card:
@@ -2504,7 +2502,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -2587,7 +2585,7 @@ paths:
cart_id: cart_UkLWZg9DAJ
channel_id: ch_UkLWZg9DAJ
number: R1001
customer_note:
currency: USD
locale: en
@@ -2595,7 +2593,7 @@ paths:
coupon_code:
fulfillment_status: backorder
payment_status: paid
- completed_at: '2026-08-15T05:11:05.441Z'
+ completed_at: '2026-08-15T06:58:51.143Z'
item_total: '10.0'
display_item_total: "$10.00"
adjustment_total: '0.0'
@@ -2627,8 +2625,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1196492
- slug: product-1196492
+ name: Product 1191944
+ slug: product-1191944
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -2693,11 +2691,11 @@ paths:
pickup_point: false
stock_location:
id: sloc_UkLWZg9DAJ
- name: Sirena Moen
+ name: Trinh Abernathy
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
- country_iso: US
+ country_code: US
country_name: United States
state_code: AL
state_text: AL
@@ -2733,7 +2731,7 @@ paths:
payments:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-069ebc72cb9c
+ response_code: BGS-4ef71a15e8cb
number: R1001-P1
amount: '20.0'
display_amount: "$20.00"
@@ -2768,13 +2766,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
shipping_address:
id: addr_OIJLhNcSbf
@@ -2788,13 +2787,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
gift_card:
market:
@@ -2804,7 +2804,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -2892,7 +2892,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: o1uGor9rNZdDFNLyDqpWLVgB
+ token: W4SC3fGJHvMwvvZa9E3vwicK
email:
customer_note:
currency: USD
@@ -2950,8 +2950,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1454328
- slug: product-1454328
+ name: Product 1454488
+ slug: product-1454488
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -2987,7 +2987,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -3080,7 +3080,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: WMZN9WapP1w64ohvSyhnr5S6
+ token: bUYUfF7zLHTV6dz47hTfatoZ
email:
customer_note:
currency: USD
@@ -3135,8 +3135,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1472916
- slug: product-1472916
+ name: Product 1478248
+ slug: product-1478248
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -3172,7 +3172,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -3254,8 +3254,8 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: UUbAtM4R1qU6zc6RcPr6KcMT
+ token: HiZJFqu3qJQY8C59UqJ6PUFb
customer_note:
currency: USD
locale: en
@@ -3303,8 +3303,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 149663
- slug: product-149663
+ name: Product 1492967
+ slug: product-1492967
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -3369,11 +3369,11 @@ paths:
pickup_point: false
stock_location:
id: sloc_UkLWZg9DAJ
- name: Barbie Cronin
+ name: Loyd Bayer
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
- country_iso: US
+ country_code: US
country_name: United States
state_code: AL
state_text: AL
@@ -3420,13 +3420,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
payment_methods: []
gift_card:
@@ -3437,7 +3438,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -3533,7 +3534,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: kbpw7GdtxuBUyPRHxCPBNPX2
+ token: Una2zZ9gJSeddM1sB1rEqQBr
email:
customer_note:
currency: USD
@@ -3584,8 +3585,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1515349
- slug: product-1515349
+ name: Product 1516736
+ slug: product-1516736
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -3612,7 +3613,7 @@ paths:
payments:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: 1-SC-20260815051110513934
+ response_code: 1-SC-20260815065855970251
number: cart_UkLWZg9DAJ-P1
amount: '10.0'
display_amount: "$10.00"
@@ -3667,7 +3668,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -3769,7 +3770,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: me273fiAWbHyqMdhULCc9UU4
+ token: k35GJyKxCwZ8fHBSt5Coyyo8
email:
customer_note:
currency: USD
@@ -3824,8 +3825,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1551398
- slug: product-1551398
+ name: Product 1559114
+ slug: product-1559114
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -3852,7 +3853,7 @@ paths:
payments:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: 1-SC-20260815051110941961
+ response_code: 1-SC-20260815065856420443
number: cart_UkLWZg9DAJ-P1
amount: '10.0'
display_amount: "$10.00"
@@ -3886,7 +3887,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -3960,7 +3961,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: mG5Mv2PNh7quYPHDfGN525Gg
+ token: CEwoz62xEjeBzc9Bx9BsrMfS
email:
customer_note:
currency: USD
@@ -3968,10 +3969,10 @@ paths:
total_quantity: 2
warnings:
- code: delivery_unavailable
- message: Product 1583764 cannot be delivered to the selected address
+ message: Product 1588178 cannot be delivered to the selected address
line_item_id: li_UkLWZg9DAJ
- code: delivery_unavailable
- message: Product 1599980 cannot be delivered to the selected address
+ message: Product 1596058 cannot be delivered to the selected address
line_item_id: li_gbHJdmfrXB
coupon_code:
item_total: '29.99'
@@ -4021,8 +4022,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1583764
- slug: product-1583764
+ name: Product 1588178
+ slug: product-1588178
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -4051,8 +4052,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1599980
- slug: product-1599980
+ name: Product 1596058
+ slug: product-1596058
options_text: ''
price: '19.99'
display_price: "$19.99"
@@ -4088,7 +4089,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -4203,7 +4204,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: fAsihZN2P79gfCgURoYGAYo6
+ token: ZTCAYqehM1NnkR1y3tPQZCi5
email:
customer_note:
currency: USD
@@ -4262,8 +4263,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 165848
- slug: product-165848
+ name: Product 1654632
+ slug: product-1654632
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -4299,7 +4300,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -4381,7 +4382,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: 8V38VS581RQ2sHaH1YWqDRk3
+ token: Kpnbw2FWwmZYsWnyW1sFvz28
email:
customer_note:
currency: USD
@@ -4439,7 +4440,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -4521,9 +4522,9 @@ paths:
id: ps_gbHJdmfrXB
status: pending
currency: USD
- external_id: bogus_4bfed6dd9f2abb7439b3a6ef
+ external_id: bogus_602e3e2e5847e9b3b0ef701f
external_data:
- client_secret: bogus_secret_30060f25d3d6669b
+ client_secret: bogus_secret_dfbf296993fdecb9
customer_external_id:
expires_at:
amount: '10.0'
@@ -4622,7 +4623,7 @@ paths:
id: ps_UkLWZg9DAJ
status: pending
currency: USD
- external_id: bogus_b46e113d0a48546de71ef1ba
+ external_id: bogus_fae9bb258ee1c8012260118f
external_data:
client_secret: secret_123
customer_external_id:
@@ -4685,7 +4686,7 @@ paths:
id: ps_UkLWZg9DAJ
status: pending
currency: USD
- external_id: bogus_d3f700ce84f20ad7a9d359b1
+ external_id: bogus_c492e8940f52563ce647b99a
external_data:
client_secret: secret_123
customer_external_id:
@@ -4788,7 +4789,7 @@ paths:
id: ps_UkLWZg9DAJ
status: completed
currency: USD
- external_id: bogus_9d6462527379ae696b48e417
+ external_id: bogus_342aeb8dcf67c0ce706b9b32
external_data:
client_secret: secret_123
customer_external_id:
@@ -4996,7 +4997,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: 4x3MkFq82ZzVWtrGLFNF4G48
+ token: seh1mVKYG6Ka5F4GQT6z8J4k
email:
customer_note:
currency: USD
@@ -5047,8 +5048,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 2277997
- slug: product-2277997
+ name: Product 2276396
+ slug: product-2276396
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -5075,7 +5076,7 @@ paths:
payments:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: 1-SC-20260815051119183245
+ response_code: 1-SC-20260815065903711944
number: cart_UkLWZg9DAJ-P1
amount: '10.0'
display_amount: "$10.00"
@@ -5115,7 +5116,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -5196,7 +5197,7 @@ paths:
channel_id: ch_UkLWZg9DAJ
preferred_stock_location_id:
number: cart_UkLWZg9DAJ
- token: SaUDmwvNufkMGpXv3yX8bPpj
+ token: sxmkypAb6ppj64mZ4A6j5pAN
email:
customer_note:
currency: USD
@@ -5251,8 +5252,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 2294420
- slug: product-2294420
+ name: Product 2293473
+ slug: product-2293473
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -5288,7 +5289,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -5376,7 +5377,7 @@ paths:
coupon_code:
fulfillment_status:
payment_status:
- completed_at: '2026-08-15T05:11:13.940Z'
+ completed_at: '2026-08-15T06:58:58.922Z'
item_total: '10.0'
display_item_total: "$10.00"
adjustment_total: '0.0'
@@ -5408,8 +5409,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1696903
- slug: product-1696903
+ name: Product 1697237
+ slug: product-1697237
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -5474,11 +5475,11 @@ paths:
pickup_point: false
stock_location:
id: sloc_UkLWZg9DAJ
- name: Leonida Sauer
+ name: Hugo Toy
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
- country_iso: US
+ country_code: US
country_name: United States
state_code: AL
state_text: AL
@@ -5524,13 +5525,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
shipping_address:
id: addr_gbHJdmfrXB
@@ -5544,13 +5546,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
gift_card:
market:
@@ -5560,7 +5563,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -5645,13 +5648,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
- id: addr_gbHJdmfrXB
first_name: John
@@ -5664,13 +5668,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: true
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
- id: addr_UkLWZg9DAJ
first_name: John
@@ -5683,13 +5688,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: true
state_abbr: NY
+ country_iso: US
state_name: New York
meta:
page: 1
@@ -5745,7 +5751,7 @@ paths:
address1: '123 Main St',
city: 'New York',
postal_code: '10001',
- country_iso: 'US',
+ country_code: 'US',
state_abbr: 'NY',
phone: '+1 555 123 4567',
}, {
@@ -5779,13 +5785,14 @@ paths:
phone: "+1 555 123 4567"
company:
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
schema:
"$ref": "#/components/schemas/Address"
@@ -5844,7 +5851,7 @@ paths:
company:
type: string
example: Acme Inc
- country_iso:
+ country_code:
type: string
example: US
description: ISO 3166-1 alpha-2 country code (e.g., "US", "DE")
@@ -5871,7 +5878,7 @@ paths:
- address1
- city
- postal_code
- - country_iso
+ - country_code
"/api/v3/store/customers/me/addresses/{id}":
get:
summary: Get an address
@@ -5934,13 +5941,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
schema:
"$ref": "#/components/schemas/Address"
@@ -6010,13 +6018,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
schema:
"$ref": "#/components/schemas/Address"
@@ -6443,7 +6452,7 @@ paths:
cart_id:
channel_id: ch_UkLWZg9DAJ
number: R1001
customer_note:
currency: USD
locale: en
@@ -6451,7 +6460,7 @@ paths:
coupon_code:
fulfillment_status:
payment_status:
- completed_at: '2026-08-15T05:11:08.201Z'
+ completed_at: '2026-08-15T06:58:53.855Z'
item_total: '10.0'
display_item_total: "$10.00"
adjustment_total: '0.0'
@@ -6483,8 +6492,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1351954
- slug: product-1351954
+ name: Product 1359530
+ slug: product-1359530
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -6549,11 +6558,11 @@ paths:
pickup_point: false
stock_location:
id: sloc_UkLWZg9DAJ
- name: Nicolas Bartell
+ name: Susanne Howell
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
- country_iso: US
+ country_code: US
country_name: United States
state_code: AL
state_text: AL
@@ -6599,13 +6608,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
shipping_address:
id: addr_VqXmZF31wY
@@ -6619,13 +6629,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
gift_card:
market:
@@ -6635,7 +6646,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -6737,7 +6748,7 @@ paths:
cart_id:
channel_id: ch_UkLWZg9DAJ
number: R1001
customer_note:
currency: USD
locale: en
@@ -6745,7 +6756,7 @@ paths:
coupon_code:
fulfillment_status:
payment_status:
- completed_at: '2026-08-15T05:11:08.427Z'
+ completed_at: '2026-08-15T06:58:54.097Z'
item_total: '10.0'
display_item_total: "$10.00"
adjustment_total: '0.0'
@@ -6777,8 +6788,8 @@ paths:
preorder_ships_at:
quantity: 1
currency: USD
- name: Product 1371809
- slug: product-1371809
+ name: Product 1375912
+ slug: product-1375912
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -6843,11 +6854,11 @@ paths:
pickup_point: false
stock_location:
id: sloc_UkLWZg9DAJ
- name: France Witting
+ name: Domonique Koelpin
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
- country_iso: US
+ country_code: US
country_name: United States
state_code: AL
state_text: AL
@@ -6893,13 +6904,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
shipping_address:
id: addr_VqXmZF31wY
@@ -6913,13 +6925,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
gift_card:
market:
@@ -6929,7 +6942,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -6986,8 +6999,8 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImVmMjY0M2Y3LWY2MTYtNGIwMS1hYzkyLWY5Y2FjNjg5Nzk5YiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2Nzc0MjY4fQ.wewo5A1-xd5Og81vfwOM4fEuKjTRRZQIgm68QACi0I8
- refresh_token: 39hLXqLBbjSo9ENWcEKnMtDC
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjY3MDVkZTBkLWE2MGUtNDFjNS1iNGRkLWI1Yjk3ZmFhODUxYiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2NzgwNzM0fQ.706EmC8czoCTG6x3CjslXlYuWu8wm7NXmdcw4D2jpxM
+ refresh_token: AWL3JYeXYSmoTsBZni9uxP8j
user:
id: cust_UkLWZg9DAJ
@@ -7004,10 +7017,10 @@ paths:
newsletter_subscriber:
id: sub_UkLWZg9DAJ
- created_at: '2026-08-15T05:11:08.626Z'
- updated_at: '2026-08-15T05:11:08.628Z'
+ created_at: '2026-08-15T06:58:54.286Z'
+ updated_at: '2026-08-15T06:58:54.288Z'
verified: true
- verified_at: '2026-08-15T05:11:08Z'
+ verified_at: '2026-08-15T06:58:54Z'
customer_id: cust_UkLWZg9DAJ
customer_groups: []
schema:
@@ -7110,12 +7123,12 @@ paths:
application/json:
example:
id: cust_UkLWZg9DAJ
- first_name: Roxane
- last_name: Williamson
+ first_name: Rory
+ last_name: Padberg
phone: 555-555-0199
accepts_email_marketing: false
- full_name: Roxane Williamson
+ full_name: Rory Padberg
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
addresses:
@@ -7130,13 +7143,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: true
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
- id: addr_UkLWZg9DAJ
first_name: John
@@ -7149,13 +7163,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: true
state_abbr: NY
+ country_iso: US
state_name: New York
default_billing_address:
id: addr_gbHJdmfrXB
@@ -7169,13 +7184,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: true
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
default_shipping_address:
id: addr_UkLWZg9DAJ
@@ -7189,13 +7205,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: true
state_abbr: NY
+ country_iso: US
state_name: New York
newsletter_subscriber:
customer_groups: []
@@ -7255,7 +7272,7 @@ paths:
application/json:
example:
id: cust_UkLWZg9DAJ
first_name: Updated
last_name: Name
phone: 555-555-0199
@@ -7275,13 +7292,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: true
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
- id: addr_UkLWZg9DAJ
first_name: John
@@ -7294,13 +7312,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: true
state_abbr: NY
+ country_iso: US
state_name: New York
default_billing_address:
id: addr_gbHJdmfrXB
@@ -7314,13 +7333,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: true
is_default_shipping: false
state_abbr: NY
+ country_iso: US
state_name: New York
default_shipping_address:
id: addr_UkLWZg9DAJ
@@ -7334,13 +7354,14 @@ paths:
phone: 555-555-0199
company: Company
country_name: United States
- country_iso: US
+ country_code: US
state_text: NY
state_code: NY
quick_checkout: false
is_default_billing: false
is_default_shipping: true
state_abbr: NY
+ country_iso: US
state_name: New York
newsletter_subscriber:
customer_groups: []
@@ -7450,7 +7471,7 @@ paths:
example:
data:
- id: gc_UkLWZg9DAJ
- code: 96D9E3EFDF1DDF9E
+ code: 93E81C61FB772E62
status: active
currency: USD
amount: '10.0'
@@ -7546,7 +7567,7 @@ paths:
application/json:
example:
id: gc_UkLWZg9DAJ
- code: 1B05E79A53E9FE9E
+ code: D91CFDF5C1250D33
status: active
currency: USD
amount: '10.0'
@@ -7618,8 +7639,8 @@ paths:
example:
id: pss_gbHJdmfrXB
status: pending
- external_id: bogus_seti_c6ce6b0709c25dca08de4801
- external_client_secret: bogus_seti_secret_46dec6a95218eb6e
+ external_id: bogus_seti_1ae6c22731c4b8b5985a1c2b
+ external_client_secret: bogus_seti_secret_ea5a717e3c94dfda
external_data: {}
payment_method_id: pm_UkLWZg9DAJ
payment_source_id:
@@ -7718,8 +7739,8 @@ paths:
example:
id: pss_UkLWZg9DAJ
status: pending
- external_id: seti_test_abf37fbb3f82fc7afbbda4e0
- external_client_secret: seti_secret_7d83f29ad62f32c8428bedcf
+ external_id: seti_test_f6886ef27b59702fec292567
+ external_client_secret: seti_secret_17af02e8de63468bd0d9b1a4
external_data:
client_secret: secret_123
payment_method_id: pm_UkLWZg9DAJ
@@ -7795,8 +7816,8 @@ paths:
example:
id: pss_UkLWZg9DAJ
status: completed
- external_id: seti_test_850a5ba0b477311cb987ce25
- external_client_secret: seti_secret_df769db407b6d0618e0de6ab
+ external_id: seti_test_08f8850d2ba99614a0a65e89
+ external_client_secret: seti_secret_76a7c6630a3e148019073570
external_data:
client_secret: secret_123
payment_method_id: pm_UkLWZg9DAJ
@@ -8330,7 +8351,7 @@ paths:
default_locale: en
tax_inclusive: false
default: true
- country_isos:
+ country_codes:
- US
supported_locales:
- en
@@ -8347,7 +8368,7 @@ paths:
default_locale: de
tax_inclusive: true
default: false
- country_isos:
+ country_codes:
- DE
- FR
supported_locales:
@@ -8434,7 +8455,7 @@ paths:
default_locale: de
tax_inclusive: true
default: false
- country_isos:
+ country_codes:
- DE
- FR
supported_locales:
@@ -8517,7 +8538,7 @@ paths:
default_locale: de
tax_inclusive: true
default: false
- country_isos:
+ country_codes:
- DE
- FR
supported_locales:
@@ -8740,7 +8761,7 @@ paths:
data:
- id: wl_UkLWZg9DAJ
name: My Wishlist
- token: frzYiWKFc3SoUYjFKQ9ygdyD
+ token: kmvxGQy6B34GePDcMFg9bK1i
is_default: false
is_private: true
meta:
@@ -8816,7 +8837,7 @@ paths:
example:
id: wl_gbHJdmfrXB
name: Birthday Ideas
- token: w4qYHpo4QcZc9Ef5UeFX5aR4
+ token: WHtJv9phiodnHTD74p76Tt3x
is_default: false
is_private: true
schema:
@@ -8917,7 +8938,7 @@ paths:
example:
id: wl_UkLWZg9DAJ
name: My Wishlist
- token: kecDSA3JGWWtHKzk9zNXCmsb
+ token: R2kcAQjKqkwzJe8au76HHnzh
is_default: false
is_private: true
schema:
@@ -8979,7 +9000,7 @@ paths:
example:
id: wl_UkLWZg9DAJ
name: Updated Name
- token: M6iXhy6aEme3xq2m4rnoQeNZ
+ token: iR3Swbo4Vc29ufKdrBDGz3Yh
is_default: false
is_private: true
schema:
@@ -9261,11 +9282,11 @@ paths:
application/json:
example:
id: sub_UkLWZg9DAJ
- created_at: '2026-08-15T05:11:12.964Z'
- updated_at: '2026-08-15T05:11:12.964Z'
+ created_at: '2026-08-15T06:58:58.204Z'
+ updated_at: '2026-08-15T06:58:58.205Z'
verified: true
- verified_at: '2026-08-15T05:11:12Z'
+ verified_at: '2026-08-15T06:58:58Z'
customer_id: cust_UkLWZg9DAJ
schema:
"$ref": "#/components/schemas/NewsletterSubscriber"
@@ -9344,10 +9365,10 @@ paths:
example:
id: sub_UkLWZg9DAJ
- created_at: '2026-08-15T05:11:12.991Z'
- updated_at: '2026-08-15T05:11:12.998Z'
+ created_at: '2026-08-15T06:58:58.229Z'
+ updated_at: '2026-08-15T06:58:58.235Z'
verified: true
- verified_at: '2026-08-15T05:11:12Z'
+ verified_at: '2026-08-15T06:58:58Z'
customer_id:
schema:
"$ref": "#/components/schemas/NewsletterSubscriber"
@@ -9517,7 +9538,7 @@ paths:
body_html: ''
- id: pol_OIJLhNcSbf
name: Privacy Policy
- slug: privacy-policy-c064bf97-54ca-498f-a7d9-d3c404a3b75a
+ slug: privacy-policy-d283591e-861c-4628-a5dc-f04a447216d2
body: We respect your privacy.
body_html: We respect your privacy.
- id: pol_uw2YK1rnl0
@@ -9857,7 +9878,7 @@ paths:
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
- country_iso: US
+ country_code: US
country_name: United States
state_code: AL
state_text: AL
@@ -10257,7 +10278,7 @@ components:
nullable: true
country_name:
type: string
- country_iso:
+ country_code:
type: string
state_text:
type: string
@@ -10274,6 +10295,8 @@ components:
state_abbr:
type: string
nullable: true
+ country_iso:
+ type: string
state_name:
type: string
nullable: true
@@ -10289,13 +10312,14 @@ components:
- phone
- company
- country_name
- - country_iso
+ - country_code
- state_text
- state_code
- quick_checkout
- is_default_billing
- is_default_shipping
- state_abbr
+ - country_iso
- state_name
x-typelizer: true
AppliedPromotion:
@@ -11081,7 +11105,7 @@ components:
type: string
member_type:
type: string
- country_iso:
+ country_code:
type: string
nullable: true
state_code:
@@ -11105,7 +11129,7 @@ components:
required:
- id
- member_type
- - country_iso
+ - country_code
- state_code
- postal_code_prefix
- postal_code_from
@@ -11687,7 +11711,7 @@ components:
type: boolean
default:
type: boolean
- country_isos:
+ country_codes:
type: array
items:
type: string
@@ -11706,7 +11730,7 @@ components:
- default_locale
- tax_inclusive
- default
- - country_isos
+ - country_codes
- supported_locales
x-typelizer: true
Media:
@@ -12807,7 +12831,7 @@ components:
zipcode:
type: string
nullable: true
- country_iso:
+ country_code:
type: string
nullable: true
country_name:
@@ -12831,7 +12855,7 @@ components:
- address1
- city
- zipcode
- - country_iso
+ - country_code
- country_name
- state_code
- state_text
diff --git a/docs/plans/5.5-admin-customers-api.md b/docs/plans/5.5-admin-customers-api.md
index cdbb377f5b..80339688c7 100644
--- a/docs/plans/5.5-admin-customers-api.md
+++ b/docs/plans/5.5-admin-customers-api.md
@@ -206,7 +206,7 @@ Hard delete only if `customer.can_be_deleted?` (no completed orders) — already
"company": null,
"state_name": "New York",
"state_abbr": "NY",
- "country_iso": "US",
+ "country_code": "US",
"country_name": "United States",
"is_default_billing": true,
"is_default_shipping": true,
@@ -230,7 +230,7 @@ Hard delete only if `customer.can_be_deleted?` (no completed orders) — already
"address1": "456 5th Ave",
"city": "New York",
"postal_code": "10001",
- "country_iso": "US",
+ "country_code": "US",
"state_abbr": "NY",
"phone": "+15551234567",
"is_default_shipping": true
diff --git a/docs/plans/6.0-6.1-split-adjustments.md b/docs/plans/6.0-6.1-split-adjustments.md
index 16c253e3d7..6abbffd18c 100644
--- a/docs/plans/6.0-6.1-split-adjustments.md
+++ b/docs/plans/6.0-6.1-split-adjustments.md
@@ -157,7 +157,7 @@ end
Columns beyond the FKs: `amount`, `rate` (decimal snapshot — enables rate-grouped tax reports and receipts even after TaxRate deletion), `label`, `included`, `provider_id` (string, e.g. `'internal'`, `'avalara'`), `data` (JSON — provider payloads such as jurisdiction breakdowns; jsonb where supported).
-**2026-08-05 additions (from the `6.0-tax-provider.md` contract refinement, driven by the spree/spree#14056 review):** `taxability_reason` (string, nullable — machine-readable cause of the treatment: `standard_rated`, `zero_rated`, `reverse_charge`, `intra_community_supply`, `export`, `customer_exempt`, …; extensible vocabulary + reason→UNTDID 5305/VATEX lookup maps live on the tax-provider plan) and the jurisdiction snapshot `country_iso` / `state_code` (the taxing jurisdiction of the line — OSS returns group per member state of consumption, and origin-taxed cases make it non-derivable from ship-to). EN 16931 category/exemption codes are deliberately NOT columns — derivable at invoicing time from the reason plus order facts.
+**2026-08-05 additions (from the `6.0-tax-provider.md` contract refinement, driven by the spree/spree#14056 review):** `taxability_reason` (string, nullable — machine-readable cause of the treatment: `standard_rated`, `zero_rated`, `reverse_charge`, `intra_community_supply`, `export`, `customer_exempt`, …; extensible vocabulary + reason→UNTDID 5305/VATEX lookup maps live on the tax-provider plan) and the jurisdiction snapshot `country_code` / `state_code` (the taxing jurisdiction of the line — OSS returns group per member state of consumption, and origin-taxed cases make it non-derivable from ship-to). EN 16931 category/exemption codes are deliberately NOT columns — derivable at invoicing time from the reason plus order facts.
**Write contract:** providers use replace-all set semantics per estimate — delete the target items' existing TaxLines, insert fresh ones. No unique-index-based upsert identity (it only works for Internal-provider lines); plain indexes on the FKs. **A provider writes a TaxLine for every item it formed a treatment for — including zero-amount treatments** (matched zero-rate, exemption, reverse charge → `amount: 0` row with its reason); an item the provider had no opinion on (Internal with no matching rates) produces no row. TaxLines are the only persisted record of tax treatment — no exemption flags on customer, order or line items.
diff --git a/docs/plans/6.0-admin-api.md b/docs/plans/6.0-admin-api.md
index 52ac47c783..8f56d1ec67 100644
--- a/docs/plans/6.0-admin-api.md
+++ b/docs/plans/6.0-admin-api.md
@@ -775,7 +775,7 @@ API key scopes: `read_vendors` / `write_vendors`, `read_commissions` / `write_co
- [x] `PATCH /api/v3/admin/tax_rates/:id`
- [x] `DELETE /api/v3/admin/tax_rates/:id`
-> **6.0:** a rate names its jurisdiction directly as `country_iso` + `state_code` codes, and tax logic moves behind a `TaxProvider` interface. See `6.0-tax-provider.md`.
+> **6.0:** a rate names its jurisdiction directly as `country_code` + `state_code` codes, and tax logic moves behind a `TaxProvider` interface. See `6.0-tax-provider.md`.
>
> `spree_tax_rates.zone_id` is **not** dropped in 6.0: `spree:migrate_tax_zones` reads it to convert existing rates, and that task runs after `db:migrate`, so removing the column in the same release would destroy its own input. It stays unread through 6.0 and comes off in 6.1.
>
diff --git a/docs/plans/6.0-core-rewrite-tasks.md b/docs/plans/6.0-core-rewrite-tasks.md
index f3a9302e24..5716b386ec 100644
--- a/docs/plans/6.0-core-rewrite-tasks.md
+++ b/docs/plans/6.0-core-rewrite-tasks.md
@@ -61,7 +61,7 @@ Each wave must land with its engine suites green (`parallel_rspec` core + api +
### T0.3 DeliveryZone model (`6.0-delivery-zones.md` Phase A) — ✅ done 2026-07-28
- [x] Tables: `spree_delivery_zones` (single consolidated `metadata` column per the Collection precedent), `spree_delivery_zone_members` (typed `member_type`: country FK / state FK / postal with `country_id` + `postal_code_from/to` range or `postal_code_prefix`).
-- [x] Models: `DeliveryZone` (`dz_`) / `DeliveryZoneMember` (`dzm_`) with `include?`/`match?`, numeric-postal country allowlist gating range members (extensible `class_attribute :range_capable_country_isos`), postal columns normalized on write, `Spree::Address.normalize_zipcode` + `#normalized_zipcode` (single home for zip normalization).
+- [x] Models: `DeliveryZone` (`dz_`) / `DeliveryZoneMember` (`dzm_`) with `include?`/`match?`, numeric-postal country allowlist gating range members (extensible `class_attribute :range_capable_country_codes`), postal columns normalized on write, `Spree::Address.normalize_zipcode` + `#normalized_zipcode` (single home for zip normalization).
- [x] `:delivery_zone` factory (+ `:delivery_zone_with_country`, `:delivery_zone_member`). No consumers swapped yet (that's T2.5).
---
@@ -258,7 +258,7 @@ The point of no return; biggest single wave. Everything before it exists so this
### Wave 6 outcome notes (2026-07-29 — COMPLETE)
-**Backend (T6.1/T6.2).** Admin nested `/orders/:id/{tax_lines,discounts,fees}` (tax read-only; discounts manual-CRUD with `422 discount_not_editable` on promotion rows; fees full CRUD, `kind` defaults `surcharge`) — all mutations run `OrderUpdater#resum_typed_totals!`, the sanctioned post-placement edit path (re-sums rows into totals WITHOUT re-running promotion competition/tax estimation; works on completed orders). `Spree::Orders::Discounts::Create` (DI `order_discount_create_service`; originally shipped as `Orders::AddManualDiscount`, renamed pre-release to match the `Fees::Create` naming) computes flat/percent line-item rows or distributes order-level via the extracted `Spree::Adjusters::LargestRemainder`. Net-new admin `delivery_methods` CRUD (+`/calculators` discovery with preference schemas; flat `calculator_type`/`calculator_preferences` params; prefixed `tax_category_id`/`delivery_zone_ids`) + `delivery_zones` CRUD (typed members by `country_iso`/`state_abbr`/postal prefix-or-range; `members` replaces the set atomically). Store `delivery_methods` discovery (`storefront_visible` scope, `fulfillment_type` filter) + `/:id/pickup_locations` (pickup-enabled stock locations, `cart_id` narrows to full-cart local coverage) + `/:id/pickup_points?latitude&longitude` via `DeliveryMethod#pickup_point_provider_instance`. Cart pickup selection: `preferred_stock_location_id` — **a real column + `belongs_to`, same shape as Order** (the 2026-07-29 preference approach was reversed 2026-08-01: `spree_carts` has no `preferences` column, so the preference never persisted); prefixed-ID resolution + the pickup-enabled/store-scoping rule live in `Carts::Update`, mirroring `Orders::Create`; copied to the order column at completion; `pickup_point_external_id` on cart fulfillment update validated via provider and frozen into `pickup_point_data`. FulfillmentSerializer: `status` column-backed, `fulfillment_type` column-with-fallback, `pickup_point_data` + `selected_delivery_rate_id` exposed, real-name associations. Admin orders scope excludes transient completion drafts (`draft` + `cart_id` set). `AppliedPromotionSerializer` rename frees `DiscountSerializer` (+`TaxLine`/`Fee`/`DeliveryZone`/`DeliveryZoneMember` serializers, registry keys, payment-session serializer gets `cart_id` + owner-bridged `order_id`). `ConfigurationManagement` grants DeliveryMethod/DeliveryZone/Member.
+**Backend (T6.1/T6.2).** Admin nested `/orders/:id/{tax_lines,discounts,fees}` (tax read-only; discounts manual-CRUD with `422 discount_not_editable` on promotion rows; fees full CRUD, `kind` defaults `surcharge`) — all mutations run `OrderUpdater#resum_typed_totals!`, the sanctioned post-placement edit path (re-sums rows into totals WITHOUT re-running promotion competition/tax estimation; works on completed orders). `Spree::Orders::Discounts::Create` (DI `order_discount_create_service`; originally shipped as `Orders::AddManualDiscount`, renamed pre-release to match the `Fees::Create` naming) computes flat/percent line-item rows or distributes order-level via the extracted `Spree::Adjusters::LargestRemainder`. Net-new admin `delivery_methods` CRUD (+`/calculators` discovery with preference schemas; flat `calculator_type`/`calculator_preferences` params; prefixed `tax_category_id`/`delivery_zone_ids`) + `delivery_zones` CRUD (typed members by `country_code`/`state_abbr`/postal prefix-or-range; `members` replaces the set atomically). Store `delivery_methods` discovery (`storefront_visible` scope, `fulfillment_type` filter) + `/:id/pickup_locations` (pickup-enabled stock locations, `cart_id` narrows to full-cart local coverage) + `/:id/pickup_points?latitude&longitude` via `DeliveryMethod#pickup_point_provider_instance`. Cart pickup selection: `preferred_stock_location_id` — **a real column + `belongs_to`, same shape as Order** (the 2026-07-29 preference approach was reversed 2026-08-01: `spree_carts` has no `preferences` column, so the preference never persisted); prefixed-ID resolution + the pickup-enabled/store-scoping rule live in `Carts::Update`, mirroring `Orders::Create`; copied to the order column at completion; `pickup_point_external_id` on cart fulfillment update validated via provider and frozen into `pickup_point_data`. FulfillmentSerializer: `status` column-backed, `fulfillment_type` column-with-fallback, `pickup_point_data` + `selected_delivery_rate_id` exposed, real-name associations. Admin orders scope excludes transient completion drafts (`draft` + `cart_id` set). `AppliedPromotionSerializer` rename frees `DiscountSerializer` (+`TaxLine`/`Fee`/`DeliveryZone`/`DeliveryZoneMember` serializers, registry keys, payment-session serializer gets `cart_id` + owner-bridged `order_id`). `ConfigurationManagement` grants DeliveryMethod/DeliveryZone/Member.
**Directives landed mid-wave (Damian):** (1) `market` + `channel` **required** on Cart AND Order (`belongs_to` without optional). Supporting invariant: **every store owns a bootstrap default market** — `Stores::Markets#ensure_default_market` is unconditional (country fallback: creation param → legacy default_country column → US, created if the countries table is empty), inherits the store's column configuration (currency/locale/supported_locales), and is flagged `bootstrap_default` so the MarketCountry shipping-coverage validation skips it (plus a `DeliveryMethod.none?` bootstrap exemption). Store column edits to default_locale/default_currency **sync onto the default market** (diff-based, not dirty-tracking); `supported_currencies_list`/`supported_locales_list` are now the **union of markets + legacy columns**; `Market#ensure_single_default` resets the owning store's association caches; markets cascade-delete with their store via `destroyed_by_association`; `Current.market` always resolves. `defined_preferences` no longer picks up `preferred_*` association writers (Order#preferred_stock_location= phantom), preference readers/writers tolerate NULL preferences columns. (2) **Promotion STI namespace rename REVERTED** — classes stay `Spree::Promotion::Rules::*`/`Spree::Promotion::Actions::*` incl. `CreateItemAdjustments` (typed-Discount behavior under legacy names; wire type back to `create_item_adjustments`; single calculator registry key; T7.5 type-column task dropped; decisions.md 2026-03-16 marked reversed). (3) Cart totals columns get **DB-level defaults** (0/0.0) in migration 100001; dummy apps rebuilt. (4) `preferred_stock_location_id` on Cart was briefly a **preference**, reversed 2026-08-01 to a real column (`create_spree_carts` migration): `spree_carts` carries no `preferences` column, so preference writes were in-memory only and the pickup choice was silently lost on save. (5) `docs/developer` updates skipped (full Spree 6 docs rewrite comes separately).
diff --git a/docs/plans/6.0-delivery-zones.md b/docs/plans/6.0-delivery-zones.md
index 216e6406ea..4e3e184646 100644
--- a/docs/plans/6.0-delivery-zones.md
+++ b/docs/plans/6.0-delivery-zones.md
@@ -39,7 +39,7 @@ The `Pricing::Context` zone dimension went with them rather than waiting for thi
## Key Decisions (do not deviate without discussion)
-- **`Spree::DeliveryZone` + `Spree::DeliveryZoneMember`**, prefix ids `dz_` / `dzm_`. Member is typed by `member_type`: `country` (FK), `state` (FK), or `postal_code` (`country_id` FK + `postal_code_from`/`postal_code_to` range, or a single `postal_code_prefix`). A zone mixes member types freely. **Superseded 2026-08-07** (`6.0-drop-country-state-models.md`): the shipped FK members convert to ISO string columns — `country_iso` on country/postal members, `country_iso` + `state_abbr` on state members (the pair, because subdivision codes aren't globally unique). Member typing, postal matching, and the admin/API contract (already ISO on the wire) are unchanged.
+- **`Spree::DeliveryZone` + `Spree::DeliveryZoneMember`**, prefix ids `dz_` / `dzm_`. Member is typed by `member_type`: `country` (FK), `state` (FK), or `postal_code` (`country_id` FK + `postal_code_from`/`postal_code_to` range, or a single `postal_code_prefix`). A zone mixes member types freely. **Superseded 2026-08-07** (`6.0-drop-country-state-models.md`): the shipped FK members convert to ISO string columns — `country_code` on country/postal members, `country_code` + `state_abbr` on state members (the pair, because subdivision codes aren't globally unique). Member typing, postal matching, and the admin/API contract (already ISO on the wire) are unchanged.
- **Postal matching is prefix-or-range, always country-scoped** (resolved 2026-07-27). Numeric-format countries (US, DE, PL, FR…) support lexicographic ranges on normalized codes (strip spaces/dashes, upcase); ranges are **gated by a numeric-postal country allowlist** — validation rejects range members for countries outside it. Non-numeric formats (UK, CA, NL, IE) get **prefix lists only** (`SW1`, `EC`, `M5V` — how merchants actually think there; UK outward codes and CA FSAs are inherently prefix-shaped). No per-country matcher strategies and no glob wildcards at launch: `DeliveryZoneMember#match?(address)` is one Ruby method with normalization in one place (`Spree::Address#normalized_zipcode`), so per-country matchers can be layered in later with zero schema change if real demand appears.
- **Empty zone list on a DeliveryMethod = worldwide** (unchanged semantics from today's zone-less methods).
- **`Spree::Zone` and `Spree::ZoneMember` are dropped in 6.0** — tables, models, `Country#zones`/`State#zones`, admin CRUD, factories. Nothing may keep a Zone reference past this plan's final phase.
@@ -69,18 +69,18 @@ class Spree::DeliveryZoneMember < Spree.base_class
belongs_to :delivery_zone, class_name: 'Spree::DeliveryZone', inverse_of: :members
- # country_iso / state_abbr string columns (2026-08-07 amendment — see Key Decisions;
+ # country_code / state_abbr string columns (2026-08-07 amendment — see Key Decisions;
# shipped as country_id/state_id FKs, converted by 6.0-drop-country-state-models.md)
validates :member_type, presence: true # 'country' | 'state' | 'postal_code'
# postal_code members: country required + exactly one of prefix / from+to range
- # state members: country_iso AND state_abbr both required
+ # state members: country_code AND state_abbr both required
def match?(address)
case member_type
- when 'country' then address.country_iso == country_iso
- when 'state' then address.country_iso == country_iso && address.state_abbr == state_abbr
- when 'postal_code' then address.country_iso == country_iso && postal_match?(address.normalized_zipcode)
+ when 'country' then address.country_code == country_code
+ when 'state' then address.country_code == country_code && address.state_abbr == state_abbr
+ when 'postal_code' then address.country_code == country_code && postal_match?(address.normalized_zipcode)
end
end
end
diff --git a/docs/plans/6.0-drop-country-state-models.md b/docs/plans/6.0-drop-country-state-models.md
index 2a617a0482..0386786451 100644
--- a/docs/plans/6.0-drop-country-state-models.md
+++ b/docs/plans/6.0-drop-country-state-models.md
@@ -8,26 +8,28 @@
## Summary
-Delete the `Spree::Country` and `Spree::State` ActiveRecord models and their tables. Countries and subdivisions become gem-backed value objects served from the `countries` gem (`ISO3166::Country`), and every consumer stores plain ISO codes (`country_iso`, `state_abbr`) instead of foreign keys. This matches the whole industry: none of Shopify, Medusa, Vendure, or Saleor points an address at a state row, and the two that keep a country table (Medusa, Vendure) treat it as a materialized cache of a static ISO list, not merchant data. Our own public surface is already there — the v3 API exposes no `id` for either model, serializes addresses as flat `country_iso`/`state_abbr`/`state_name` strings, and the dashboard submits ISO codes only — so the entire change is internal to the Ruby layer, with zero API contract change and zero frontend change.
+Delete the `Spree::Country` and `Spree::State` ActiveRecord models and their tables. Countries and subdivisions become gem-backed value objects served from the `countries` gem (`ISO3166::Country`), and every consumer stores plain ISO codes (`country_code`, `state_abbr`) instead of foreign keys. This matches the whole industry: none of Shopify, Medusa, Vendure, or Saleor points an address at a state row, and the two that keep a country table (Medusa, Vendure) treat it as a materialized cache of a static ISO list, not merchant data. Our own public surface is already there — the v3 API exposes no `id` for either model, serializes addresses as flat `country_code`/`state_abbr`/`state_name` strings, and the dashboard submits ISO codes only — so the change is internal to the Ruby layer apart from the field renames recorded under Naming.
## Implementation status (2026-08-14)
-**Shipped.** `Spree::Country` and `Spree::State` are plain value objects backed by the `countries` gem; carmen, the country/state seeds, and the row-creating fallbacks (`Store#default_country_iso=`, `Stores::Markets#create_fallback_country`) are gone. Every consumer stores and matches on ISO codes: `country_iso` / `state_code` columns on addresses, delivery zone members, market countries, stock locations and stores, filled by `spree:upgrade:migrate_country_state_isos` (in the 5.6→6.0 manifest after the delivery-zone conversion). `Spree::IsoData` is the curated reference registry, covered by a guard spec that replays the old Carmen seed and fails if any code it produced stops resolving. The country endpoints dropped their conditional GETs, the admin address endpoints stopped accepting raw foreign keys, and the test factories build real countries and real subdivisions. Zero v3 contract change — the entire API suite passes untouched.
+**Shipped.** `Spree::Country` and `Spree::State` are plain value objects backed by the `countries` gem; carmen, the country/state seeds, and the row-creating fallbacks (`Store#default_country_code=`, `Stores::Markets#create_fallback_country`) are gone. Every consumer stores and matches on ISO codes: `country_code` / `state_code` columns on addresses, delivery zone members, market countries, stock locations and stores, filled by `spree:upgrade:migrate_country_state_codes` (in the 5.6→6.0 manifest after the delivery-zone conversion). `Spree::IsoData` is the curated reference registry, covered by a guard spec that replays the old Carmen seed and fails if any code it produced stops resolving. The country endpoints dropped their conditional GETs, the admin address endpoints stopped accepting raw foreign keys, and the test factories build real countries and real subdivisions. The v3 contract changed only in the field names (see Naming below); the suites pass with the renames applied.
-**Naming (2026-08-14, extended 2026-08-15):** **`state_code`** is the one name — column, model, and v3 API, store side included — matching the tax tables (`spree_tax_rates`, `spree_tax_lines` carry `country_iso`/`state_code`). 6.0 is the breaking window, so the rename is not hidden behind an alias: stock locations, delivery zone members and every new model speak `state_code` only. The single exception is `Spree::Address`, which keeps `state_abbr` as a deprecated `alias_attribute`, a deprecated read attribute on the store `AddressSerializer`, and an accepted write param — storefronts shipped against that name. 6.1 removes all three.
+**Naming (2026-08-14, extended 2026-08-15):** **`country_code` + `state_code`** is the one pair — column, model, and v3 API, store side included. Both halves read as one decision; the earlier `country_iso`/`state_code` split was defensible (a country code is a complete ISO 3166-1 value, a subdivision code is only the second segment) but nobody reading the API would infer it, and no other platform says `country_iso` — Shopify, Medusa, Vendure and Saleor all say `country_code`. 6.0 is the breaking window, so the rename is not hidden behind an alias: stock locations, delivery zone members, market countries, tax rates, tax lines, tax exemption certificates and every new model speak `country_code`/`state_code` only, and `Market` exposes `country_codes`. The single exception is `Spree::Address`, which keeps `country_iso` and `state_abbr` as deprecated `alias_attribute`s, deprecated read attributes on the store `AddressSerializer`, and accepted write params — storefronts shipped against those names. 6.1 removes them.
+
+`Spree::Store` collapses the odd column/virtual split at the same time: the column is `default_country_code` (was `default_country_iso_code`) and the market-aware reader carries that name, with `default_country_iso_code` and the virtual `default_country_iso=` kept as deprecated shells until 6.1. `Promotion::Rules::Country` renames its preferences to `country_codes`/`country_code`, and because preference keys are stored data rather than schema, reads fall back to the old `country_isos`/`country_iso` keys so rules saved earlier keep matching.
**One concern, no duplication (2026-08-14):** `Spree::HasIsoGeography` (included into `Spree::Base`, the `has_spree_number` pattern) is the single declaration for code-storing models — `has_iso_geography` gives upcasing normalization, ISO validation of both codes (state checked against its country, gated on change so historical rows stay updatable) and registry-backed `country`/`state` readers; `state: false` for country-only tables. Declared by `Address`, `StockLocation`, `DeliveryZoneMember`, `MarketCountry`, `TaxRate`, `TaxLine` and `TaxExemptionCertificate`. Only `Spree::Address` layers object writers (`country=`/`state=`) on top — everything else assigns codes; the stock-location, zone-member and market-country object writers are gone, and test factories carry `country:`/`state:` as transients mapped to codes.
-**What became of the tax gate.** The tax-provider Phase 5 rewrite shipped on main: `TaxRate` matches on `country_iso`/`state_code` scopes and nothing at runtime reads `Spree::Zone` any more. `Spree::Zone`/`Spree::ZoneMember` survive purely as migration-only shells — no polymorphic `zoneable` association, no matching; the 5.6→6.0 data tasks (`migrate_zones_to_delivery_zones`, `migrate_checkout_zones`, `migrate_tax_zones`) resolve member ids directly against the legacy `spree_countries`/`spree_states` tables via SQL. Both shells drop in 6.1 with the tables.
+**What became of the tax gate.** The tax-provider Phase 5 rewrite shipped on main: `TaxRate` matches on `country_code`/`state_code` scopes and nothing at runtime reads `Spree::Zone` any more. `Spree::Zone`/`Spree::ZoneMember` survive purely as migration-only shells — no polymorphic `zoneable` association, no matching; the 5.6→6.0 data tasks (`migrate_zones_to_delivery_zones`, `migrate_checkout_zones`, `migrate_tax_zones`) resolve member ids directly against the legacy `spree_countries`/`spree_states` tables via SQL. Both shells drop in 6.1 with the tables.
## Key Decisions (do not deviate without discussion)
- **The `countries` gem is the sole data source** (resolved 2026-08-07). `ISO3166::Country` already powers localized names, currency, and locale at runtime today; it also carries subdivisions, so it absorbs what Carmen seeded. `carmen` is removed from the gemspec entirely. No vendored data file — we accept the gem as a dependency we already have.
- **`Spree::Country` and `Spree::State` keep their constant names but become plain Ruby value objects** (`ActiveModel::Model` + `ActiveModel::Attributes`, same pattern as `Spree::PickupPointOption`). `Spree::Country.by_iso('US')`, `#name`, `#states`, `#states_required?`, `#zipcode_required?`, `#localized_name`, `#default_currency` all survive with the same signatures. ActiveRecord calls (`.where`, `.find`, associations) fail loudly with `NoMethodError` — acceptable in the 6.0 breaking window, and better than silently different query semantics.
- **Address validation semantics are preserved exactly** (resolved 2026-08-07). For `STATES_REQUIRED` countries the submitted `state_abbr` must match a gem subdivision code, and a `state_name` matching a subdivision name is still promoted to its code; for every other country `state_name` stays free text. The `STATES_REQUIRED` and `NO_ZIPCODE_ISO_CODES` constants on `Spree::Address` — already the seed-time source of truth — become the runtime source of truth. A Google-address-ruleset upgrade (Saleor's `i18naddress` approach) is explicitly out of scope; the validation seam is designed so it can slot in later.
-- **Tables drop in 6.1, not 6.0** (resolved 2026-08-07, revised 2026-08-13). Code switches to ISO strings in 6.0, but `spree_countries`/`spree_states` and every `country_id`/`state_id` column survive the release: `spree:upgrade:migrate_country_state_isos` reads them to fill the ISO columns, so dropping them in the same release would leave the upgrade task nothing to read on exactly the installs that need it. Same pattern as the returns-chain tables. See the Migration Path for the authoritative sequencing.
-- **`6.0-tax-provider.md` Phase 5 is amended before it ships** (resolved 2026-08-07). `spree_tax_rates` (and later `TaxExemptionCertificate`) get `country_iso`/`state_abbr` **string columns**, never `country_id`/`state_id` FKs. Verified 2026-08-07 that the FK columns do not exist yet — amending now converts a double migration into a saving. The "state-level rate overrides country-level" precedence rule carries over to string matching unchanged.
-- **Subdivision codes are only meaningful with their country.** Every table storing a `state_abbr` also stores the `country_iso` (`spree_addresses`, `spree_delivery_zone_members`, `spree_stock_locations`, tax rates). Abbreviations are not globally unique (`CA` is California and several other things); the pair is the identifier. This also fixes the existing bug where the admin delivery-zones controller resolved a bare abbr against `Spree::State` globally.
+- **Tables drop in 6.1, not 6.0** (resolved 2026-08-07, revised 2026-08-13). Code switches to ISO strings in 6.0, but `spree_countries`/`spree_states` and every `country_id`/`state_id` column survive the release: `spree:upgrade:migrate_country_state_codes` reads them to fill the ISO columns, so dropping them in the same release would leave the upgrade task nothing to read on exactly the installs that need it. Same pattern as the returns-chain tables. See the Migration Path for the authoritative sequencing.
+- **`6.0-tax-provider.md` Phase 5 is amended before it ships** (resolved 2026-08-07). `spree_tax_rates` (and later `TaxExemptionCertificate`) get `country_code`/`state_abbr` **string columns**, never `country_id`/`state_id` FKs. Verified 2026-08-07 that the FK columns do not exist yet — amending now converts a double migration into a saving. The "state-level rate overrides country-level" precedence rule carries over to string matching unchanged.
+- **Subdivision codes are only meaningful with their country.** Every table storing a `state_abbr` also stores the `country_code` (`spree_addresses`, `spree_delivery_zone_members`, `spree_stock_locations`, tax rates). Abbreviations are not globally unique (`CA` is California and several other things); the pair is the identifier. This also fixes the existing bug where the admin delivery-zones controller resolved a bare abbr against `Spree::State` globally.
- **The v3 API contract does not change.** Country/State are already the only v3 resources addressed by natural key with no prefixed ID; serializers keep emitting `iso`/`iso3`/`name`/`states_required`/`zipcode_required` and `abbr`/`name`. Controllers keep the same routes, params, and caching; only their backing store changes. One accepted value drift: `name` now comes from the gem's CLDR data instead of the Carmen-seeded column, so a few country names may read slightly differently. The dashboard already prefers the browser's `Intl.DisplayNames` over the API `name`, so admin UI display is unaffected.
- **The two admin endpoints that still accept raw `country_id`/`state_id` params drop them** (admin customer addresses, admin order addresses). They were the only place integer FKs crossed the wire; every other endpoint is already ISO-only.
- **The two ISO→record resolution paths are unified first.** Today `Spree::Addresses::Helper` silently nils an unrecognized ISO while the `Address` model callbacks no-op; after this plan there is one normalization path on the model, and an unrecognized code is a validation error, never silent data loss.
@@ -60,7 +62,7 @@ end
class Spree::State
attribute :abbr, :string # subdivision code without country prefix ('CA', not 'US-CA')
attribute :name, :string
- attribute :country_iso, :string # always present — abbr alone is ambiguous
+ attribute :country_code, :string # always present — abbr alone is ambiguous
end
```
@@ -70,30 +72,30 @@ The country list is process-memoized and immutable. `EXCLUDED_COUNTRIES` (the ni
| Table | Today | After |
|---|---|---|
-| `spree_addresses` | `country_id` (FK, required), `state_id` (FK, optional), `state_name` | `country_iso` (`null: false`), `state_abbr`, `state_name` (unchanged) |
-| `spree_delivery_zone_members` | `country_id`, `state_id` | `country_iso`, `state_abbr` — **state members now carry both** |
-| `spree_market_countries` | `country_id` | `country_iso`; uniqueness `(market_id, country_iso)` |
-| `spree_stock_locations` | `country_id`, `state_id` | `country_iso`, `state_abbr` |
-| `spree_stores` | `default_country_id` | `default_country_iso` |
+| `spree_addresses` | `country_id` (FK, required), `state_id` (FK, optional), `state_name` | `country_code` (`null: false`), `state_code`, `state_name` (unchanged) |
+| `spree_delivery_zone_members` | `country_id`, `state_id` | `country_code`, `state_code` — **state members now carry both** |
+| `spree_market_countries` | `country_id` | `country_code`; uniqueness `(market_id, country_code)` |
+| `spree_stock_locations` | `country_id`, `state_id` | `country_code`, `state_code` |
+| `spree_stores` | `default_country_id` | `default_country_code` |
| `spree_states` | `country_id` | table dropped |
-| `spree_tax_rates` (unshipped) | — (plan specced FKs) | born as `country_iso`, `state_abbr` |
+| `spree_tax_rates` (unshipped) | — (plan specced FKs) | born as `country_code`, `state_code` |
-ISO codes are stored upcased 2-letter; `state_abbr` upcased without the country prefix (matches today's seeded values, the API contract, and what the dashboard submits).
+ISO codes are stored upcased 2-letter; `state_code` upcased without the country prefix (matches today's seeded values, the API contract, and what the dashboard submits).
### Address
-The model keeps its public shape: `country_iso`/`state_abbr` stop being buffered virtual writers resolved through `before_validation` lookups and become the actual columns. `country_name`, `country_iso3`, `state_text`, `state_name_text`, `require_zipcode?`, `gateway_hash` all read through the value objects. `state_validate` keeps its exact decision tree, backed by `country.states` from the gem instead of `country.states` from the DB. `Spree::Addresses::Helper`'s duplicate resolution logic is deleted; `Addresses::Create`/`Update` pass the ISO params straight to the model.
+The model keeps its public shape: `country_code`/`state_code` stop being buffered virtual writers resolved through `before_validation` lookups and become the actual columns. `country_name`, `country_iso3`, `state_text`, `state_name_text`, `require_zipcode?`, `gateway_hash` all read through the value objects. `state_validate` keeps its exact decision tree, backed by `country.states` from the gem instead of `country.states` from the DB. `Spree::Addresses::Helper`'s duplicate resolution logic is deleted; `Addresses::Create`/`Update` pass the ISO params straight to the model.
-Ransack: `whitelisted_ransackable_associations` drops `country`/`state`; `country_iso` and `state_abbr` join the ransackable attributes so existing admin filtering keeps working as plain string predicates.
+Ransack: `whitelisted_ransackable_associations` drops `country`/`state`; `country_code` and `state_code` join the ransackable attributes so existing admin filtering keeps working as plain string predicates.
### Consumers, converted
-- **`DeliveryZoneMember#match?`** — string comparison instead of FK integers: `address.country_iso == country_iso`, and for state members `country_iso` + `state_abbr` both. `range_capable_country_isos` is already an ISO allowlist. The admin controller's ISO→FK conversion layer is deleted.
-- **`Store#countries_with_shipping_coverage`** — the state→country SQL hop disappears because state members now carry their own `country_iso`: the query becomes a union of member `country_iso` values, hydrated through the registry and sorted by localized name.
-- **`Market` / `MarketCountry`** — `country_isos` (already the API façade) becomes the storage reality. `for_country` takes an ISO, `default_country` picks first by localized name, both cross-market validations (`country_unique_per_store`, `country_covered_by_shipping_zone`) become string queries.
-- **`Store#default_country`** returns a value object; `default_country_iso=` stops creating rows (it can't — there are no rows), as does the market-bootstrap `create_fallback_country`. Fallback is simply `Spree::Country.by_iso('US')`, which always exists.
+- **`DeliveryZoneMember#match?`** — string comparison instead of FK integers: `address.country_code == country_code`, and for state members `country_code` + `state_code` both. `range_capable_country_codes` is already an ISO allowlist. The admin controller's ISO→FK conversion layer is deleted.
+- **`Store#countries_with_shipping_coverage`** — the state→country SQL hop disappears because state members now carry their own `country_code`: the query becomes a union of member `country_code` values, hydrated through the registry and sorted by localized name.
+- **`Market` / `MarketCountry`** — `country_codes` (already the API façade) becomes the storage reality. `for_country` takes an ISO, `default_country` picks first by localized name, both cross-market validations (`country_unique_per_store`, `country_covered_by_shipping_zone`) become string queries.
+- **`Store#default_country`** returns a value object; `default_country_code=` stops creating rows (it can't — there are no rows), as does the market-bootstrap `create_fallback_country`. Fallback is simply `Spree::Country.by_iso('US')`, which always exists.
- **`StockLocation`** — same conversion as Address; its ISO writers already exist.
-- **`Carts::Update#clear_shipping_address_if_outside_market`** — compares `country_iso` strings instead of `country_ids`.
+- **`Carts::Update#clear_shipping_address_if_outside_market`** — compares `country_code` strings instead of `country_ids`.
- **`Promotion::Rules::Country`** — already ISO-native; only its display-hydration helper switches to the registry. This class was the template for the whole refactor.
- **Zone / ZoneMember** — not converted. They are removed by `6.0-delivery-zones.md` Phase D before this plan's final phase; the polymorphic member design never gets a string rewrite.
@@ -108,19 +110,19 @@ Sequenced inside 6.0, after `6.0-fulfillment-and-delivery.md`'s shipped surface
1. ✅ **Docs first:** amend `6.0-tax-provider.md` Phase 5 to string columns, record the decision in `decisions.md`, superseding notes in `6.0-delivery-zones.md` and `6.0-admin-api.md`.
2. ✅ **Safe pre-work (independent of everything):** close the admin `country_id`/`state_id` param leak; unify the two ISO resolution paths onto the Address model.
3. ✅ **The registry:** `Spree::IsoData` plus the guard spec that replays the old seed, and the `ISO3166` locale configuration (in `after_initialize`, not an initializer — `Spree.available_locales` is not populated that early).
-4. ✅ **String columns + backfill:** the new `*_iso`/`*_abbr` columns; `spree:upgrade:migrate_country_state_isos` in the 5.6→6.0 manifest, resumable via `where(country_iso: nil)`; every reader and validation converted.
+4. ✅ **String columns + backfill:** the new `*_iso`/`*_abbr` columns; `spree:upgrade:migrate_country_state_codes` in the 5.6→6.0 manifest, resumable via `where(country_code: nil)`; every reader and validation converted.
5. ✅ **Test data:** factories build real countries and real subdivisions, with postal codes their country accepts.
6. ⏸ **Registry swap — blocked on `Spree::Zone`:** replace the AR models with the value objects and delete the seeds, the `carmen` dependency and the row-creating fallbacks. Needs `6.0-tax-provider.md` Phase 5 and then `6.0-delivery-zones.md` Phase D.
-7. ⏸ **Drop — deferred to 6.1 (2026-08-13):** `spree_countries`, `spree_states`, and every legacy `country_id`/`state_id`/`default_country_id` column. The tables survive 6.0 as the upgrade task's source data — `spree:upgrade:migrate_country_state_isos` reads them to fill the ISO columns, and dropping them in the same release would leave the task nothing to read on exactly the installs that need it. Same pattern as the returns-chain tables. Nothing writes them in 6.0; `spree_market_countries.country_id` is relaxed to nullable since rows are created without it.
+7. ⏸ **Drop — deferred to 6.1 (2026-08-13):** `spree_countries`, `spree_states`, and every legacy `country_id`/`state_id`/`default_country_id` column. The tables survive 6.0 as the upgrade task's source data — `spree:upgrade:migrate_country_state_codes` reads them to fill the ISO columns, and dropping them in the same release would leave the task nothing to read on exactly the installs that need it. Same pattern as the returns-chain tables. Nothing writes them in 6.0; `spree_market_countries.country_id` is relaxed to nullable since rows are created without it.
Tax Phase 5 slots in wherever it lands on its own schedule — with the amendment it creates string columns directly and needs nothing from steps 3–5. It is, however, what unblocks steps 6 and 7.
## Constraints on Current Work
-- **No new `country_id`/`state_id` FK columns or `belongs_to :country`/`:state` associations anywhere.** New features store `country_iso` (+ `state_abbr` where subdivisions matter, always as a pair) — the `Promotion::Rules::Country` / `DeliveryZoneMember.range_capable_country_isos` pattern.
+- **No new `country_id`/`state_id` FK columns or `belongs_to :country`/`:state` associations anywhere.** New features store `country_code` (+ `state_code` where subdivisions matter, always as a pair) — the `Promotion::Rules::Country` / `DeliveryZoneMember.range_capable_country_codes` pattern.
- **Tax-provider Phase 5 implements the amended spec** (string columns) — the FK version in older revisions of that plan is superseded.
- **Don't build anything on Country/State being queryable ActiveRecord** — no new Ransack predicates through the `country`/`state` associations, no new joins to `spree_countries`/`spree_states`, no code that creates Country rows.
-- **Address-adjacent code reads geography through the model's ISO accessors** (`country_iso`, `state_abbr`, `state_text`), never through `address.country.id` or the state association.
+- **Address-adjacent code reads geography through the model's ISO accessors** (`country_code`, `state_code`, `state_text`), never through `address.country.id` or the state association.
## Open Questions
diff --git a/docs/plans/6.0-store-context-and-first-run-setup.md b/docs/plans/6.0-store-context-and-first-run-setup.md
index eb3cd73336..560db4807e 100644
--- a/docs/plans/6.0-store-context-and-first-run-setup.md
+++ b/docs/plans/6.0-store-context-and-first-run-setup.md
@@ -55,7 +55,7 @@ A `StoreContext` concern in the v3 Admin base controller resolves `current_store
**Endpoints** (unauthenticated, rate-limited like login, mounted under `auth/` so the refresh-cookie path matches — same shape as invitation acceptance):
- `GET /api/v3/admin/auth/setup` → `{ "setup_required": true | false }`. True only while zero admin users exist. Safe to expose: it leaks one boolean that is also self-evident from a fresh install.
-- `POST /api/v3/admin/auth/setup` → params: `setup_token`, `email`, `password`, `first_name`, `last_name`, `store_name`, optional `currency`/`country_iso`. Guards, in order: admin count is zero; the submitted token matches the store's `setup_token` (`secure_compare`), re-checked under a lock on the store so concurrent submissions cannot both spend it. Effects, in one transaction: create the admin user, `add_user` with the `admin` role on the default store, rename/configure the store, clear the `setup_token` column. Then issue the refresh cookie + JWT exactly like `InvitationAcceptancesController` and return the admin-user payload. Any later call 404s (setup no longer required).
+- `POST /api/v3/admin/auth/setup` → params: `setup_token`, `email`, `password`, `first_name`, `last_name`, `store_name`, optional `currency`/`country_code`. Guards, in order: admin count is zero; the submitted token matches the store's `setup_token` (`secure_compare`), re-checked under a lock on the store so concurrent submissions cannot both spend it. Effects, in one transaction: create the admin user, `add_user` with the `admin` role on the default store, rename/configure the store, clear the `setup_token` column. Then issue the refresh cookie + JWT exactly like `InvitationAcceptancesController` and return the admin-user payload. Any later call 404s (setup no longer required).
**Setup token mechanics.** The token is a `has_secure_token :setup_token` on `Spree::Store` — generated when the seed creates the default store, so a repeated `db:seed` reprints the same URL. `Store#setup_url` builds it on top of `Spree::Stores::DashboardUrl`, the single resolver for "where is the dashboard" now shared by the setup link, invitation emails and the SSO callback: `Spree::Config[:dashboard_url]` (env-backed, see below) → the deprecated `admin_url` → **this app's own `/dashboard` mount** when `spree_dashboard` is installed with a build to serve → the Vite dev server in development → the store's own URL.
diff --git a/docs/plans/6.0-tax-provider.md b/docs/plans/6.0-tax-provider.md
index 8eb1a85fca..918236b0aa 100644
--- a/docs/plans/6.0-tax-provider.md
+++ b/docs/plans/6.0-tax-provider.md
@@ -175,7 +175,7 @@ Why this is needed: European e-invoices must state, for **every** line, which ta
**TaxLine gains:**
- `taxability_reason` (string, nullable) — machine-readable cause of the treatment. Core vocabulary: `standard_rated`, `reduced_rated`, `zero_rated`, `reverse_charge`, `intra_community_supply`, `export`, `customer_exempt`, `product_exempt`, `not_collecting`, `not_subject_to_tax`. Held in an extensible class-level list on `Spree::TaxLine` (additive registration, `HasStatus`-style) with an inclusion validation allowing nil. Acceptance bar for new values: the reason maps to a distinct invoice category code, or to a distinct box on a tax return. (Vocabulary basis: Stripe's enum with the Stripe-internal mechanics pruned, plus `intra_community_supply` and `export` — Stripe's single `reverse_charge` and `zero_rated` values cannot tell cross-border goods apart from cross-border services, or an export apart from a domestic zero rate, and invoices need both distinctions.)
-- Jurisdiction snapshot: `country_iso` (string), `state_code` (string, nullable) — the taxing jurisdiction of this line. Rationale is **reporting and queryability**, not an invoice requirement: the EU's one-stop-shop return is filed per destination country, one section per country, so "which country's tax was this" has to be a query — and origin-taxed cases (below-threshold consumer digital sales, US states that source to the seller) make it non-derivable from the shipping address. European e-invoices have no place-of-supply field at all; they carry a delivery country for cross-border EU goods, which the order already has.
+- Jurisdiction snapshot: `country_code` (string), `state_code` (string, nullable) — the taxing jurisdiction of this line. Rationale is **reporting and queryability**, not an invoice requirement: the EU's one-stop-shop return is filed per destination country, one section per country, so "which country's tax was this" has to be a query — and origin-taxed cases (below-threshold consumer digital sales, US states that source to the seller) make it non-derivable from the shipping address. European e-invoices have no place-of-supply field at all; they carry a delivery country for cross-border EU goods, which the order already has.
**Deliberately NOT columns:** the invoice category code, the exemption reason code and the legal-reference wording. All three follow deterministically at invoicing time from `taxability_reason` plus order facts — the pattern Odoo uses, and Odoo's whole job is producing these invoices: it derives the codes at export from tax configuration and the sale's facts, and stores none of them per line. No surveyed commerce platform (Medusa, Saleor, commercetools, Shopify) stores them either. Storing the reason instead of the legal codes keeps core out of a legal vocabulary that gets revised on someone else's schedule, while still giving e-invoicing integrations everything they need. One-sentence rationale for the field: *a machine-readable reason distinguishes zero-tax causes that land in different boxes of a tax return, and lets e-invoicing integrations derive the category and exemption codes that European invoicing mandates require.*
@@ -378,7 +378,7 @@ class Spree::TaxExemption
attribute :reason_code, :string # resale, government, … (Avalara entityUseCode territory)
attribute :certificate_number, :string # = future TaxExemptionCertificate#certificate_number
- attribute :country_iso, :string # nil = all countries — same codes the certificate holds
+ attribute :country_code, :string # nil = all countries — same codes the certificate holds
attribute :state_code, :string # nil = entire country — same codes the certificate holds
attribute :item_overrides # Array<ItemOverride>; empty = applies to all items
@@ -569,7 +569,7 @@ State-level rates override country-level (more specific wins). **Tax stops using
**`spree_tax_rates.zone_id` is dropped in 6.1, not 6.0.** The column is what `spree:migrate_tax_zones` converts *from*, and the manifest runs after `db:migrate` — so a migration dropping it in the same release would destroy the conversion's own input, and leave no rollback source if a merchant needs to re-run it.
-**The gap this leaves, and why it stays a gap.** Between `db:migrate` and the conversion task, an unconverted rate has no `country_iso` — and a blank country means *everywhere*, so a rate configured for one country matches every destination and over-collects until the task runs. The fix is not to move the conversion into the migration: data transformations belong in rake tasks (see `CLAUDE.md`), the manifest deliberately runs after `db:migrate`, and `migrate_adjustments_to_typed_rows` and the delivery migration already carry the same window. Two things keep it small — `bin/rake spree:upgrade` runs the manifest immediately after migrating, and the task is idempotent, so it can be re-run without thought. **An upgrade that serves traffic between the two steps should expect over-collection in that window**; failing the other way (treating unconverted rates as taxing nothing) trades a customer-facing error for an under-collection the merchant is liable for, which is the worse of the two. 6.0 therefore severs every reader (the `belongs_to :zone`, the zone scopes, and `Zone#has_many :tax_rates`, whose `dependent: :destroy` would otherwise delete live rates when a shipping zone is destroyed) and leaves the column in place, unread. This matches how `spree_adjustments` is handled by `migrate_adjustments_to_typed_rows`. **Phase 9** drops the column alongside the other converted-away schema.
+**The gap this leaves, and why it stays a gap.** Between `db:migrate` and the conversion task, an unconverted rate has no `country_code` — and a blank country means *everywhere*, so a rate configured for one country matches every destination and over-collects until the task runs. The fix is not to move the conversion into the migration: data transformations belong in rake tasks (see `CLAUDE.md`), the manifest deliberately runs after `db:migrate`, and `migrate_adjustments_to_typed_rows` and the delivery migration already carry the same window. Two things keep it small — `bin/rake spree:upgrade` runs the manifest immediately after migrating, and the task is idempotent, so it can be re-run without thought. **An upgrade that serves traffic between the two steps should expect over-collection in that window**; failing the other way (treating unconverted rates as taxing nothing) trades a customer-facing error for an under-collection the merchant is liable for, which is the worse of the two. 6.0 therefore severs every reader (the `belongs_to :zone`, the zone scopes, and `Zone#has_many :tax_rates`, whose `dependent: :destroy` would otherwise delete live rates when a shipping zone is destroyed) and leaves the column in place, unread. This matches how `spree_adjustments` is handled by `migrate_adjustments_to_typed_rows`. **Phase 9** drops the column alongside the other converted-away schema.
## Design Details
@@ -948,7 +948,7 @@ module Spree
included: rate.included_in_price,
provider_id: 'internal',
taxability_reason: reason, # 'standard_rated' / 'zero_rated' / 'customer_exempt'
- country_iso: rate.country_iso,
+ country_code: rate.country_code,
state_code: rate.state_code
)
end
@@ -990,7 +990,7 @@ module SpreeTaxAvalara
included: avalara_line.tax_included,
provider_id: 'avalara',
taxability_reason: taxability_reason_for(avalara_line),
- country_iso: avalara_line.country,
+ country_code: avalara_line.country,
state_code: avalara_line.region,
data: { 'jurisdictions' => avalara_line.details }
)
@@ -1059,12 +1059,12 @@ The **admin** side adds `validation_status`, `validated_at`, `validation_evidenc
**Tax lines.** The store serializer already exists (`label`, `rate`, `included`, `amount`) but no store endpoint consumes it — only `/admin/orders/:id/tax_lines`. Two changes:
- **Expose tax lines on the Store API**, nested on cart and order line items. Totals alone cannot render an order confirmation or an account invoice, and every comparable platform exposes per-line tax to the customer (Medusa, commercetools, Vendure, Shopify's Customer Account API).
-- **`taxability_reason` and the jurisdiction snapshot are admin-only.** No surveyed platform exposes a machine-readable reason to buyers, and the customer-facing need is met by `label`, which is already there. The cost of this choice is asymmetric in our favour: withholding a field and adding it later is additive, exposing one and removing it is breaking. The admin serializer gains `taxability_reason`, `country_iso`, `state_code` **and `data`** — currently unserialized anywhere, though it is exactly the jurisdiction breakdown an e-invoicing integration needs. No derived invoice code is exposed: that mapping belongs to the integration, not to core.
-- **Ransack allowlist** on `Spree::TaxLine` for `taxability_reason`, `country_iso` and `state_code`. Reporting is the stated rationale for those columns — "which country's tax was this, and which sales were reverse-charged" has to be answerable — and without the allowlist they are write-only.
+- **`taxability_reason` and the jurisdiction snapshot are admin-only.** No surveyed platform exposes a machine-readable reason to buyers, and the customer-facing need is met by `label`, which is already there. The cost of this choice is asymmetric in our favour: withholding a field and adding it later is additive, exposing one and removing it is breaking. The admin serializer gains `taxability_reason`, `country_code`, `state_code` **and `data`** — currently unserialized anywhere, though it is exactly the jurisdiction breakdown an e-invoicing integration needs. No derived invoice code is exposed: that mapping belongs to the integration, not to core.
+- **Ransack allowlist** on `Spree::TaxLine` for `taxability_reason`, `country_code` and `state_code`. Reporting is the stated rationale for those columns — "which country's tax was this, and which sales were reverse-charged" has to be answerable — and without the allowlist they are write-only.
**Tax rates.** `/admin/tax_rates` — full CRUD, admin-only (rates are back-office configuration; the storefront never sees them). This plan owns building them even though `6.0-admin-api.md` carries the checkboxes, for a blunt reason: **TaxRate rows are the Internal provider's entire configuration**, so without these endpoints the default tax engine cannot be set up or inspected through the API at all, and nothing about its behavior can be verified outside a console or a spec. Tax categories already have their endpoints; rates are the missing half.
-Serializer fields: `name`, `amount` (plus `amount_percentage`, the virtual the admin forms use), `included_in_price`, `show_rate_in_label`, `tax_category_id`, `store_id`, `metadata`, timestamps and `deleted_at` (the model is paranoid). The jurisdiction field follows the schema of the moment — `zone_id` until Phase 5, `country_iso`/`state_code` after it, which is the one place these endpoints get reworked. `whitelisted_ransackable_attributes` already covers `amount`, `tax_category_id`, `included_in_price` and `name`, so filtering comes free; Phase 5 swaps `zone_id` for the country and state codes there too.
+Serializer fields: `name`, `amount` (plus `amount_percentage`, the virtual the admin forms use), `included_in_price`, `show_rate_in_label`, `tax_category_id`, `store_id`, `metadata`, timestamps and `deleted_at` (the model is paranoid). The jurisdiction field follows the schema of the moment — `zone_id` until Phase 5, `country_code`/`state_code` after it, which is the one place these endpoints get reworked. `whitelisted_ransackable_attributes` already covers `amount`, `tax_category_id`, `included_in_price` and `name`, so filtering comes free; Phase 5 swaps `zone_id` for the country and state codes there too.
**Provider discovery and selection.**
@@ -1093,7 +1093,7 @@ Shipped with the core-rewrite waves, not as originally phased: no "Internal dele
### Phase 3: contract enrichment (this revision)
-- TaxLine: `taxability_reason` + vocabulary registry + the invoice-category / exemption-reason lookup maps + `country_iso`/`state_code` columns; zero-amount write contract in the Internal provider.
+- TaxLine: `taxability_reason` + vocabulary registry + the invoice-category / exemption-reason lookup maps + `country_code`/`state_code` columns; zero-amount write contract in the Internal provider.
- `Spree::TaxIdentifier` model + customer/cart/order FKs + `readonly?` freeze + completion copy step.
- API: `/admin/tax_rates` CRUD (without it the Internal provider cannot be configured or verified through the API — see the API surface section), tax identifier endpoints (with admin `validatable` + the re-validate action), tax lines exposed on the Store API, admin tax-line serializer gaining `taxability_reason`/jurisdiction/`data`, and the Ransack allowlist for tax reporting.
- `estimate` signature: `tax_date:`/`tax_identifier:`/`exemptions:`/`context:`; `refund(order, return_items, tax_date:)` replaces `refund(owner, amount)`; `exempt?` removed.
@@ -1116,13 +1116,13 @@ Tax-side only — shipping keeps Zone untouched; full Zone removal is deferred t
```ruby
# rake spree:migrate_tax_zones
# For each Zone used by TaxRate:
-# Extract country/state from ZoneMembers → set TaxRate.country_iso / TaxRate.state_code
+# Extract country/state from ZoneMembers → set TaxRate.country_code / TaxRate.state_code
# (Zone with multiple countries = one TaxRate per country)
```
-- Add `country_iso`/`state_code` to `spree_tax_rates`; run the data task; sever every `zone_id` reader.
+- Add `country_code`/`state_code` to `spree_tax_rates`; run the data task; sever every `zone_id` reader.
The column itself is dropped in **Phase 9**, not here — the conversion cannot drop its own input.
-- Update the `/admin/tax_rates` serializer, permitted params and Ransack allowlist from `zone_id` to `country_iso`/`state_code` — the only rework those endpoints take, and the reason they are worth building in Phase 3 rather than waiting.
+- Update the `/admin/tax_rates` serializer, permitted params and Ransack allowlist from `zone_id` to `country_code`/`state_code` — the only rework those endpoints take, and the reason they are worth building in Phase 3 rather than waiting.
- Retire the tax-side zone readers rather than rewriting them: `Order#tax_zone`,
`Spree::Current.zone`/`default_tax_zone`, `Market#tax_zone` and `Zone.default_tax` all answered
"where is this buyer taxed", which `#tax_country` now answers directly. `Spree::Current.tax_country`
@@ -1235,7 +1235,7 @@ class CreateSpreeTaxExemptionCertificates < ActiveRecord::Migration[8.1]
def change
create_table :spree_tax_exemption_certificates do |t|
t.references :company, null: false
- t.string :country_iso # nil = every country
+ t.string :country_code # nil = every country
t.string :state_code # nil = the entire country
t.string :certificate_number, null: false
t.string :reason_code, null: false # resale, government, … — becomes the
@@ -1292,7 +1292,7 @@ def call(order:)
Spree::TaxExemption.new(
reason_code: certificate.reason_code,
certificate_number: certificate.certificate_number,
- country_iso: certificate.country&.iso,
+ country_code: certificate.country&.iso,
state_code: certificate.state&.abbr
)
end
diff --git a/docs/v6/developer/core-concepts/carts.mdx b/docs/v6/developer/core-concepts/carts.mdx
index 1310eee9f7..b36ac530cd 100644
--- a/docs/v6/developer/core-concepts/carts.mdx
+++ b/docs/v6/developer/core-concepts/carts.mdx
@@ -140,7 +140,7 @@ This is what lets you design your own checkout. Spree tells you what's missing;
shipping_address: {
first_name: 'John', last_name: 'Doe',
address1: '123 Main St', city: 'Los Angeles',
- country_iso: 'US', state_abbr: 'CA', postal_code: '90001',
+ country_code: 'US', state_abbr: 'CA', postal_code: '90001',
},
})
```
diff --git a/docs/v6/developer/core-concepts/fulfillments.mdx b/docs/v6/developer/core-concepts/fulfillments.mdx
index 4ba05f7f31..310f28451d 100644
--- a/docs/v6/developer/core-concepts/fulfillments.mdx
+++ b/docs/v6/developer/core-concepts/fulfillments.mdx
@@ -200,8 +200,8 @@ Zones match on country and state, and also on postal code prefixes and ranges, s
await adminClient.deliveryZones.create({
name: 'London same-day',
members: [
- { member_type: 'postal_code', country_iso: 'GB', postal_code_prefix: 'SW1' },
- { member_type: 'postal_code', country_iso: 'GB', postal_code_from: 'EC1A', postal_code_to: 'EC1V' },
+ { member_type: 'postal_code', country_code: 'GB', postal_code_prefix: 'SW1' },
+ { member_type: 'postal_code', country_code: 'GB', postal_code_from: 'EC1A', postal_code_to: 'EC1V' },
],
})
```
diff --git a/packages/admin-sdk/examples/companies/locations-create.ts b/packages/admin-sdk/examples/companies/locations-create.ts
index eec70fb221..75bdfd8b49 100644
--- a/packages/admin-sdk/examples/companies/locations-create.ts
+++ b/packages/admin-sdk/examples/companies/locations-create.ts
@@ -14,7 +14,7 @@ const location = await client.companies.locations.create('comp_UkLWZg9DAJ', {
address1: 'Hafenstr 1',
city: 'Hamburg',
postal_code: '20095',
- country_iso: 'DE',
+ country_code: 'DE',
},
})
diff --git a/packages/admin-sdk/examples/customer-addresses/create.ts b/packages/admin-sdk/examples/customer-addresses/create.ts
index 220f48fcfd..2fbc18fc81 100644
--- a/packages/admin-sdk/examples/customer-addresses/create.ts
+++ b/packages/admin-sdk/examples/customer-addresses/create.ts
@@ -12,7 +12,7 @@ const address = await client.customers.addresses.create('cus_UkLWZg9DAJ', {
address1: '350 Fifth Avenue',
city: 'New York',
postal_code: '10118',
- country_iso: 'US',
+ country_code: 'US',
state_code: 'NY',
phone: '+1 212 555 1234',
label: 'Office',
diff --git a/packages/admin-sdk/examples/delivery-zones/create.ts b/packages/admin-sdk/examples/delivery-zones/create.ts
index ac5933a16d..9ae160e4c2 100644
--- a/packages/admin-sdk/examples/delivery-zones/create.ts
+++ b/packages/admin-sdk/examples/delivery-zones/create.ts
@@ -9,8 +9,8 @@ const client = createAdminClient({
const deliveryZone = await client.deliveryZones.create({
name: 'US North-East',
members: [
- { member_type: 'country', country_iso: 'US' },
- { member_type: 'postal_code', country_iso: 'US', postal_code_prefix: '10' },
+ { member_type: 'country', country_code: 'US' },
+ { member_type: 'postal_code', country_code: 'US', postal_code_prefix: '10' },
],
})
diff --git a/packages/admin-sdk/examples/markets/create.ts b/packages/admin-sdk/examples/markets/create.ts
index 4fe03b30a1..4db1943ccb 100644
--- a/packages/admin-sdk/examples/markets/create.ts
+++ b/packages/admin-sdk/examples/markets/create.ts
@@ -12,8 +12,9 @@ const market = await client.markets.create({
default_locale: 'de',
supported_locales: ['de', 'en', 'fr'],
tax_inclusive: true,
- country_isos: ['DE', 'FR', 'IT'],
+ country_codes: ['DE', 'FR', 'IT'],
})
+
// endregion:example
export { market }
diff --git a/packages/admin-sdk/examples/markets/update.ts b/packages/admin-sdk/examples/markets/update.ts
index 63e0814015..e77b9cb053 100644
--- a/packages/admin-sdk/examples/markets/update.ts
+++ b/packages/admin-sdk/examples/markets/update.ts
@@ -6,14 +6,15 @@ const client = createAdminClient({
})
// region:example
-// `country_isos` is a full-set update — the market is reconciled to match
+// `country_codes` is a full-set update — the market is reconciled to match
// the array (adds new countries, removes ones not present). Setting
// `default: true` demotes the previous default market in the store.
const market = await client.markets.update('market_UkLWZg9DAJ', {
name: 'European Union',
tax_inclusive: true,
- country_isos: ['DE', 'FR'],
+ country_codes: ['DE', 'FR'],
})
+
// endregion:example
export { market }
diff --git a/packages/admin-sdk/examples/orders/create.ts b/packages/admin-sdk/examples/orders/create.ts
index 0480fca2a0..568e9f9173 100644
--- a/packages/admin-sdk/examples/orders/create.ts
+++ b/packages/admin-sdk/examples/orders/create.ts
@@ -48,7 +48,7 @@ const order = await client.orders.create({
address2: 'Floor 42',
city: 'New York',
postal_code: '10118',
- country_iso: 'US',
+ country_code: 'US',
state_code: 'NY',
phone: '+1 212 555 1234',
company: 'Acme Inc.',
@@ -61,7 +61,7 @@ const order = await client.orders.create({
address1: '350 Fifth Avenue',
city: 'New York',
postal_code: '10118',
- country_iso: 'US',
+ country_code: 'US',
state_code: 'NY',
phone: '+1 212 555 1234',
},
diff --git a/packages/admin-sdk/examples/stock-locations/create.ts b/packages/admin-sdk/examples/stock-locations/create.ts
index 86183c34d9..0c2e7db532 100644
--- a/packages/admin-sdk/examples/stock-locations/create.ts
+++ b/packages/admin-sdk/examples/stock-locations/create.ts
@@ -9,7 +9,7 @@ const client = createAdminClient({
const stockLocation = await client.stockLocations.create({
name: 'Brooklyn warehouse',
kind: 'warehouse',
- country_iso: 'US',
+ country_code: 'US',
state_code: 'NY',
city: 'Brooklyn',
zipcode: '11201',
diff --git a/packages/admin-sdk/examples/tax-exemption-certificates/create.ts b/packages/admin-sdk/examples/tax-exemption-certificates/create.ts
index 3f4b5505f6..91d572e2e2 100644
--- a/packages/admin-sdk/examples/tax-exemption-certificates/create.ts
+++ b/packages/admin-sdk/examples/tax-exemption-certificates/create.ts
@@ -19,7 +19,7 @@ const { signed_id } = await client.directUploads.create({
const certificate = await client.companies.taxExemptionCertificates.create('comp_UkLWZg9DAJ', {
certificate_number: 'DE-RESALE-7',
reason_code: 'resale',
- country_iso: 'DE',
+ country_code: 'DE',
document: signed_id,
})
diff --git a/packages/admin-sdk/examples/tax-rates/create.ts b/packages/admin-sdk/examples/tax-rates/create.ts
index ac17926886..98d9b19737 100644
--- a/packages/admin-sdk/examples/tax-rates/create.ts
+++ b/packages/admin-sdk/examples/tax-rates/create.ts
@@ -10,7 +10,7 @@ const client = createAdminClient({
const taxRate = await client.taxRates.create({
name: 'German VAT',
amount: 0.19,
- country_iso: 'DE',
+ country_code: 'DE',
tax_category_id: 'txc_UkLWZg9DAJ',
included_in_price: true,
})
diff --git a/packages/admin-sdk/examples/tax-rates/list.ts b/packages/admin-sdk/examples/tax-rates/list.ts
index 9cf50ef6cd..b6ab3a74b7 100644
--- a/packages/admin-sdk/examples/tax-rates/list.ts
+++ b/packages/admin-sdk/examples/tax-rates/list.ts
@@ -6,7 +6,7 @@ const client = createAdminClient({
})
// region:example
-const { data: taxRates } = await client.taxRates.list({ country_iso_eq: 'DE' })
+const { data: taxRates } = await client.taxRates.list({ country_code_eq: 'DE' })
// endregion:example
diff --git a/packages/admin-sdk/src/params.ts b/packages/admin-sdk/src/params.ts
index 4dc583709d..f88fcce8ef 100644
--- a/packages/admin-sdk/src/params.ts
+++ b/packages/admin-sdk/src/params.ts
@@ -352,7 +352,7 @@ export interface AddressInputParams {
address2?: string
city?: string
postal_code?: string
- country_iso?: string
+ country_code?: string
state_code?: string
phone?: string
company?: string
@@ -516,7 +516,7 @@ export interface CustomerAddressParams {
postal_code?: string
country_id?: string
state_id?: string
- country_iso?: string
+ country_code?: string
state_code?: string
phone?: string
company?: string
@@ -990,7 +990,7 @@ export interface SetupParams {
/** ISO currency code for the store, e.g. `USD`. */
currency?: string
/** ISO 3166-1 alpha-2 country code for the store, e.g. `US`. */
- country_iso?: string
+ country_code?: string
}
/** Body for requesting a password reset email. */
@@ -1046,7 +1046,7 @@ export interface StockLocationCreateParams {
phone?: string | null
company?: string | null
/** ISO-3166 alpha-2 country code (e.g. 'US'). */
- country_iso?: string | null
+ country_code?: string | null
/** State / province abbreviation (e.g. 'NY'). Resolved against the selected country's states. */
state_code?: string | null
/** Free-text state for countries that don't have a states list. */
@@ -1072,7 +1072,7 @@ export interface StockLocationUpdateParams {
zipcode?: string | null
phone?: string | null
company?: string | null
- country_iso?: string | null
+ country_code?: string | null
state_code?: string | null
state_name?: string | null
pickup_enabled?: boolean
@@ -1245,7 +1245,7 @@ export interface MarketCreateParams {
/** Sort order within the store; lower = first. */
position?: number
/** 2-letter ISO country codes assigned to this market. At least one is required. */
- country_isos: string[]
+ country_codes: string[]
/**
* Class name of the tax engine that prices this market, from
* `taxProviders.list()`. `null` uses the installation default.
@@ -1261,7 +1261,7 @@ export interface MarketUpdateParams {
tax_inclusive?: boolean
default?: boolean
position?: number
- country_isos?: string[]
+ country_codes?: string[]
tax_provider?: string | null
}
@@ -1955,7 +1955,7 @@ export interface DeliveryMethodServiceParams {
export interface DeliveryZoneMemberParams {
member_type: 'country' | 'state' | 'postal_code'
- country_iso?: string
+ country_code?: string
state_code?: string
postal_code_prefix?: string
postal_code_from?: string
@@ -1989,7 +1989,7 @@ export interface CompanyLocationAddressParams {
postal_code?: string
zipcode?: string
phone?: string
- country_iso?: string
+ country_code?: string
state_code?: string
state_name?: string
label?: string
@@ -2020,7 +2020,7 @@ export interface TaxExemptionCertificateParams {
/** Becomes the tax provider's entity use code, e.g. `resale`. */
reason_code?: string
/** Where the certificate holds. Omit both for one valid everywhere. */
- country_iso?: string | null
+ country_code?: string | null
state_code?: string | null
issued_at?: string | null
expires_at?: string | null
@@ -2034,7 +2034,7 @@ export interface TaxRateParams {
name?: string
amount?: number | string
/** Where the rate applies. A rate naming no country taxes everywhere. */
- country_iso?: string | null
+ country_code?: string | null
state_code?: string | null
tax_category_id?: string
included_in_price?: boolean
diff --git a/packages/admin-sdk/src/types/generated/Address.ts b/packages/admin-sdk/src/types/generated/Address.ts
index 6e9d4b673e..2fcd5bd976 100644
--- a/packages/admin-sdk/src/types/generated/Address.ts
+++ b/packages/admin-sdk/src/types/generated/Address.ts
@@ -1,4 +1,4 @@
-// Typelizer digest bc9e0d0cd91dbbc7a03e4dfe0c18692f
+// Typelizer digest 24044bb3f128587099bcfefc81083294
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
@@ -14,13 +14,14 @@ interface Address {
phone: string | null;
company: string | null;
country_name: string;
- country_iso: string;
+ country_code: string;
state_text: string | null;
state_code: string | null;
quick_checkout: boolean;
is_default_billing: boolean;
is_default_shipping: boolean;
state_abbr: string | null;
+ country_iso: string;
state_name: string | null;
label: string | null;
metadata: Record<string, unknown>;
diff --git a/packages/admin-sdk/src/types/generated/DeliveryZoneMember.ts b/packages/admin-sdk/src/types/generated/DeliveryZoneMember.ts
index b4db29fb48..d3b83be45f 100644
--- a/packages/admin-sdk/src/types/generated/DeliveryZoneMember.ts
+++ b/packages/admin-sdk/src/types/generated/DeliveryZoneMember.ts
@@ -1,11 +1,11 @@
-// Typelizer digest ab3788c72f6bda40cc2080caa2c284e0
+// Typelizer digest f1b8fc3eaea278ce8d8418405e55b6da
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
interface DeliveryZoneMember {
id: string;
member_type: string;
- country_iso: string | null;
+ country_code: string | null;
state_code: string | null;
postal_code_prefix: string | null;
postal_code_from: string | null;
diff --git a/packages/admin-sdk/src/types/generated/Market.ts b/packages/admin-sdk/src/types/generated/Market.ts
index 69a12b83f5..a0aa544fc2 100644
--- a/packages/admin-sdk/src/types/generated/Market.ts
+++ b/packages/admin-sdk/src/types/generated/Market.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 3a86f2db1c82f77d3a9ef3ca5079fbe4
+// Typelizer digest 095833704b32302f3cdf81ad852ac4a0
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Country} from '@/types'
@@ -10,7 +10,7 @@ interface Market {
default_locale: string;
tax_inclusive: boolean;
default: boolean;
- country_isos: Array<string>;
+ country_codes: Array<string>;
supported_locales: Array<string>;
countries?: Array<Country>;
tax_provider: string | null;
diff --git a/packages/admin-sdk/src/types/generated/StockLocation.ts b/packages/admin-sdk/src/types/generated/StockLocation.ts
index b961d71854..225b4e313b 100644
--- a/packages/admin-sdk/src/types/generated/StockLocation.ts
+++ b/packages/admin-sdk/src/types/generated/StockLocation.ts
@@ -1,4 +1,4 @@
-// Typelizer digest da064d6df77235f2c6e384f52926e0d8
+// Typelizer digest 100d4da3c36db4aa2ea5aefc208d5f25
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
@@ -8,7 +8,7 @@ interface StockLocation {
address1: string | null;
city: string | null;
zipcode: string | null;
- country_iso: string | null;
+ country_code: string | null;
country_name: string | null;
state_code: string | null;
state_text: string | null;
diff --git a/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts b/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts
index 23adc5b874..8b28f07cd2 100644
--- a/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts
+++ b/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 1ccbae6c1fb791309d0dc15575065d17
+// Typelizer digest 190e2b6952ca401ddfb8a21a55258488
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
@@ -15,7 +15,7 @@ interface TaxExemptionCertificate {
created_at: string;
updated_at: string;
company_id: string;
- country_iso: string | null;
+ country_code: string | null;
state_code: string | null;
active: boolean;
lapsed: boolean;
diff --git a/packages/admin-sdk/src/types/generated/TaxLine.ts b/packages/admin-sdk/src/types/generated/TaxLine.ts
index 38311212c9..7d09587c73 100644
--- a/packages/admin-sdk/src/types/generated/TaxLine.ts
+++ b/packages/admin-sdk/src/types/generated/TaxLine.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 72bdc039886bf786c6204b06fca47bf3
+// Typelizer digest 7242c0c02556a2a52921f715dd65de5b
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
@@ -16,7 +16,7 @@ interface TaxLine {
provider_id: string | null;
metadata: Record<string, unknown> | null;
taxability_reason: string | null;
- country_iso: string | null;
+ country_code: string | null;
state_code: string | null;
data: Record<string, unknown> | null;
created_at: string;
diff --git a/packages/admin-sdk/src/types/generated/TaxRate.ts b/packages/admin-sdk/src/types/generated/TaxRate.ts
index 5d77530242..3f7dc31f4b 100644
--- a/packages/admin-sdk/src/types/generated/TaxRate.ts
+++ b/packages/admin-sdk/src/types/generated/TaxRate.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 27339acd4f535352c55ee15119f8662c
+// Typelizer digest 8e8127ce4fc16b3cff3947a6ea5d20a3
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
@@ -15,7 +15,7 @@ interface TaxRate {
amount_percentage: number | null;
tax_category_id: string | null;
store_id: string | null;
- country_iso: string | null;
+ country_code: string | null;
state_code: string | null;
}
diff --git a/packages/admin-sdk/tests/companies.test.ts b/packages/admin-sdk/tests/companies.test.ts
index 255d0fe9b1..2e9507b46a 100644
--- a/packages/admin-sdk/tests/companies.test.ts
+++ b/packages/admin-sdk/tests/companies.test.ts
@@ -32,7 +32,7 @@ const sampleCertificate = {
certificate_number: 'DE-RESALE-1',
reason_code: 'resale',
status: 'pending',
- country_iso: 'DE',
+ country_code: 'DE',
state_code: null,
active: false,
lapsed: false,
@@ -107,13 +107,13 @@ describe('companies', () => {
const listed = await client.companies.locations.list('comp_abc123')
await client.companies.locations.create('comp_abc123', {
name: 'Hamburg',
- billing_address: { city: 'Hamburg', country_iso: 'DE' },
+ billing_address: { city: 'Hamburg', country_code: 'DE' },
})
expect(listed.data[0]?.id).toBe('cloc_abc123')
expect(body).toEqual({
name: 'Hamburg',
- billing_address: { city: 'Hamburg', country_iso: 'DE' },
+ billing_address: { city: 'Hamburg', country_code: 'DE' },
})
})
diff --git a/packages/admin-sdk/tests/tax-rates.test.ts b/packages/admin-sdk/tests/tax-rates.test.ts
index d768752d2d..3cf9fa5e8c 100644
--- a/packages/admin-sdk/tests/tax-rates.test.ts
+++ b/packages/admin-sdk/tests/tax-rates.test.ts
@@ -10,7 +10,7 @@ const sampleTaxRate = {
// the numeric form is the separate amount_percentage.
amount: '0.19',
amount_percentage: 19.0,
- country_iso: 'DE',
+ country_code: 'DE',
state_code: null,
included_in_price: true,
show_rate_in_label: true,
@@ -28,10 +28,10 @@ describe('taxRates', () => {
}),
)
- const res = await createTestClient().taxRates.list({ country_iso_eq: 'DE' })
+ const res = await createTestClient().taxRates.list({ country_code_eq: 'DE' })
expect(res.data[0]?.id).toBe('txr_abc123')
- expect(url!.searchParams.get('q[country_iso_eq]')).toBe('DE')
+ expect(url!.searchParams.get('q[country_code_eq]')).toBe('DE')
})
// A rate names its jurisdiction directly rather than pointing at a zone.
@@ -47,7 +47,7 @@ describe('taxRates', () => {
await createTestClient().taxRates.create({
name: 'California Sales Tax',
amount: 0.0825,
- country_iso: 'US',
+ country_code: 'US',
state_code: 'CA',
tax_category_id: 'txc_1',
})
@@ -55,7 +55,7 @@ describe('taxRates', () => {
expect(body).toEqual({
name: 'California Sales Tax',
amount: 0.0825,
- country_iso: 'US',
+ country_code: 'US',
state_code: 'CA',
tax_category_id: 'txc_1',
})
diff --git a/packages/cli/src/generated/admin-spec.json b/packages/cli/src/generated/admin-spec.json
index 30a93fa519..e498157683 100644
--- a/packages/cli/src/generated/admin-spec.json
+++ b/packages/cli/src/generated/admin-spec.json
@@ -1 +1 @@
-{"info":{"title":"Admin API","contact":{"name":"Spree Commerce","url":"https://spreecommerce.org","email":"[email protected]"},"description":"Spree Admin API v3 - Administrative API for managing products, orders, and store settings.\n\n## Authentication\n\nThe Admin API requires a secret API key passed in the `x-spree-api-key` header.\nSecret API keys can be generated in the Spree admin dashboard.\n\n## Response Format\n\nAll responses are JSON. List endpoints return paginated responses with `data` and `meta` keys.\nSingle resource endpoints return a flat JSON object.\n\n## Resource IDs\n\nEvery resource is identified by an opaque string ID (e.g. `prod_86Rf07xd4z`,\n`variant_k5nR8xLq`, `or_UkLWZg9DAJ`). Use these IDs everywhere — URL paths,\nrequest bodies, and Ransack filters all accept them directly.\n\n## Error Handling\n\nErrors return a consistent format:\n```json\n{\n \"error\": {\n \"code\": \"validation_error\",\n \"message\": \"Validation failed\",\n \"details\": { \"name\": [\"can't be blank\"] }\n }\n}\n```\n","version":"v3"},"paths":{"/api/v3/admin/auth/login":{"post":{"summary":"Login","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Authenticates an admin user and returns a short-lived JWT access token.\nThe rotatable refresh token is set in an HttpOnly cookie — it is not\nincluded in the response body.\n\nThe `provider` field selects the authentication method. When omitted it\ndefaults to `email`, the built-in email/password login.\n\nTo authenticate against a third-party identity provider (Okta, Azure AD,\nGoogle Workspace SSO, a custom JWT issuer, SAML, etc.), send\n`{ \"provider\": \"<your_key>\", ... }` with the fields that provider\nrequires. The endpoint returns the same JWT regardless of which provider\nauthenticated the request. See\n[Custom API Authentication](https://spreecommerce.org/docs/developer/how-to/custom-api-authentication)\nfor the list of configured providers and their required fields.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"login successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"title":"EmailPasswordLogin","description":"Built-in email/password authentication (default when `provider` is omitted).","type":"object","properties":{"provider":{"type":"string","enum":["email"],"default":"email"},"email":{"type":"string","format":"email"},"password":{"type":"string"}},"required":["email","password"]},{"title":"ProviderLogin","description":"Provider-dispatched login. The `provider` key selects a configured\nauthentication provider; the remaining fields are forwarded to it.\nRequired fields depend on the provider — see\n[Custom API Authentication](https://spreecommerce.org/docs/developer/how-to/custom-api-authentication).\n","type":"object","properties":{"provider":{"type":"string","description":"Registered provider key (anything other than `email`).","not":{"enum":["email"]}}},"required":["provider"],"additionalProperties":true}]}}}}}},"/api/v3/admin/auth/refresh":{"post":{"summary":"Refresh token","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Exchanges the HttpOnly refresh-token cookie for a new access JWT and a\nrotated refresh token cookie. No request body or Authorization header\nis required — the cookie alone authenticates the call.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"refresh successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"missing or invalid refresh-token cookie","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/auth/logout":{"post":{"summary":"Logout","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Revokes the refresh-token cookie, effectively logging the admin out.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"logout successful"}}}},"/api/v3/admin/me":{"get":{"summary":"Get current admin user and permissions","tags":["Authentication"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the current admin user profile and a serialized list of permissions (CanCanCan rules). The SPA uses these to drive UI permission checks.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"current admin user and permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update the current admin profile","tags":["Authentication"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Self-service update of the signed-in admin's own profile, such as their admin UI display language (`selected_locale`).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"profile updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"selected_locale":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"}}}}}}}},"/api/v3/admin/auth/password_resets":{"post":{"summary":"Request password reset","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Requests a password reset email for an admin user. Always returns `202`\nwhether or not the email matches an account, to prevent enumeration.\n\n`redirect_url` is where the emailed link should point (the reset token\nis appended as a `token` query param). It must match one of the store's\nallowed origins — otherwise it is silently ignored and the server-side\ndefault is used. The email is delivered by Spree itself via the\n`admin_user.password_reset_requested` event; this event is never\nforwarded to webhook endpoints.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"reset requested","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"redirect_url":{"type":"string","description":"Must match an allowed origin of the store; ignored otherwise."}},"required":["email"]}}}}}},"/api/v3/admin/auth/password_resets/{id}":{"patch":{"summary":"Reset password","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Consumes a password reset token (the `token` query param from the\nemailed link), sets the new password, and signs the admin in: the\nresponse carries a JWT access token and the rotatable refresh token is\nset in an HttpOnly cookie. The token is single-use — it invalidates as\nsoon as the password changes.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","description":"The reset token from the emailed link","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"password reset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"422":{"description":"invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string"},"password_confirmation":{"type":"string"}},"required":["password","password_confirmation"]}}}}}},"/api/v3/admin/auth/setup":{"get":{"summary":"Check first-run setup availability","tags":["Authentication"],"description":"Reports whether first-run setup is still available — true only while\nthe installation has no admin user. Unauthenticated; the dashboard\nlogin page uses it to offer the setup screen.\n","responses":{"200":{"description":"setup status","content":{"application/json":{}}}}},"post":{"summary":"Complete first-run setup","tags":["Authentication"],"description":"Creates the first admin account and adopts the seeded store, authorized\nby the one-time setup token printed at install time (rotate it with\n`bin/rails spree:setup:token`). Issues a JWT access token and a\nrefresh-token cookie exactly like login. Returns 404 once any admin\nuser exists — the flow is closed permanently after setup.\n","parameters":[],"responses":{"200":{"description":"setup completed","content":{"application/json":{}}},"404":{"description":"setup not available","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["setup_token","email","password"],"properties":{"setup_token":{"type":"string","description":"One-time token from the install output."},"email":{"type":"string","format":"email"},"password":{"type":"string"},"password_confirmation":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"store_name":{"type":"string"},"currency":{"type":"string","description":"ISO currency code for the store."},"country_iso":{"type":"string","description":"ISO 3166-1 alpha-2 country code for the store."}}}}}}}},"/api/v3/admin/allowed_origins":{"get":{"summary":"List allowed origins","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the CORS allowlist for the current store. Each entry is a\nbare `scheme://host[:port]` permitted to call the admin API from a\nbrowser. Backs the `Rack::Cors` allowlist and the CSRF boundary of\nthe admin cookie session (see\n`docs/plans/5.5-admin-auth-cookie-refresh.md`).\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[origin_cont]","in":"query","required":false,"description":"Filter by origin (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origins found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AllowedOrigin"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds an origin to the admin CORS allowlist. The value must be a bare\n`scheme://host[:port]` (no path, query, or fragment) and use `http` or\n`https`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"allowed origin created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"origin":{"type":"string"}},"required":["origin"]}}}}}},"/api/v3/admin/allowed_origins/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Allowed origin ID","schema":{"type":"string"}}],"get":{"summary":"Get an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single allowed origin by prefixed ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origin found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"404":{"description":"allowed origin not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing allowed origin.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origin updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"origin":{"type":"string"}}}}}}},"delete":{"summary":"Delete an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes an origin from the admin CORS allowlist. After deletion the\nadmin SPA running at that origin will no longer be able to call the\nadmin API from a browser.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"allowed origin deleted"}}}},"/api/v3/admin/api_keys":{"get":{"summary":"List API keys","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns publishable and secret API keys for the current store. Secret keys are listed by `token_prefix` only — the plaintext token is delivered exactly once on create.\n\n**Required scope:** `read_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API keys found","content":{"application/json":{}}}}},"post":{"summary":"Create an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a publishable or secret API key. The plaintext token is included in the response **once** for secret keys; publishable keys expose their token on every read since they are intended for client-side use.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"secret key created — plaintext token returned once","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","key_type"],"properties":{"name":{"type":"string"},"key_type":{"type":"string","enum":["publishable","secret"]},"scopes":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/api_keys/{id}":{"get":{"summary":"Show an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key found","content":{"application/json":{}}}}},"patch":{"summary":"Update an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Renames a key. `key_type` and `scopes` are fixed at creation — to change a key's authority, create a new key and revoke the old one.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key renamed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}}},"delete":{"summary":"Delete an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"API key deleted"}}}},"/api/v3/admin/api_keys/current":{"get":{"summary":"Describe the current API key","tags":["API Keys"],"security":[{"api_key":[]}],"description":"Returns the secret key that authenticated this request, including its live scopes. Useful to confirm a key's real, current authority. Only secret-key principals have a single key to describe.\n\n**Required scope:** none — any key can describe itself (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"current API key","content":{"application/json":{}}}}}},"/api/v3/admin/api_keys/{id}/revoke":{"patch":{"summary":"Revoke an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Marks the key revoked. Future requests using its token will fail; the row is preserved for audit.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key revoked","content":{"application/json":{}}}}}},"/api/v3/admin/categories":{"get":{"summary":"List categories","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of the store's categories (manual hierarchical taxons; rule-based collections are excluded).\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., children, parent, ancestors).","schema":{"type":"string"}}],"responses":{"200":{"description":"categories found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a category. Nests under the parent when parent_id is given, otherwise creates a top-level category.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"category created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"parent_id":{"type":"string","description":"Prefixed ID of the parent category"},"description":{"type":"string"},"permalink":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"}},"required":["name"]}}}}}},"/api/v3/admin/categories/{id}":{"get":{"summary":"Get a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single category by ID.\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., children, parent, ancestors).","schema":{"type":"string"}}],"responses":{"200":{"description":"category found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}},"404":{"description":"category not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a category.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"category updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"parent_id":{"type":"string","description":"Prefixed ID of the parent category"},"description":{"type":"string"},"permalink":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"}}}}}}},"delete":{"summary":"Delete a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a category and its descendants.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"204":{"description":"category deleted"}}}},"/api/v3/admin/categories/{id}/reposition":{"patch":{"summary":"Reposition a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a category to a new parent and/or index within the tree.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"category repositioned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_parent_id":{"type":"string","description":"Prefixed ID of the new parent (omit for top level)"},"new_position":{"type":"integer","description":"0-based index among the new parent's children"}},"required":["new_position"]}}}}}},"/api/v3/admin/categories/{category_id}/products":{"get":{"summary":"List category products","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Products classified under the category, ordered by their classification position.\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Add a product to a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Classifies a product under the category (appended to the end).\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"201":{"description":"product added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"string"}},"required":["product_id"]}}}}}},"/api/v3/admin/categories/{category_id}/products/{id}":{"delete":{"summary":"Remove a product from a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes a product from the category's manual classification.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product removed"}}}},"/api/v3/admin/categories/{category_id}/products/{id}/reposition":{"patch":{"summary":"Reposition a category product","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a product to a new index among the category's products.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product repositioned"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_position":{"type":"integer","description":"0-based index among the category's products"}},"required":["new_position"]}}}}}},"/api/v3/admin/channels":{"get":{"summary":"List channels","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the channels configured for the current store.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"channels found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new channel on the current store. `code` is normalized to a\nURL-safe slug (`Point of Sale` → `point-of-sale`); when omitted it's\nderived from `name`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"channel created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"code":{"type":"string","description":"Slug — auto-derived from `name` when blank."},"active":{"type":"boolean","default":true},"default":{"type":"boolean","default":false},"preferred_order_routing_strategy":{"type":"string","nullable":true,"description":"Routing strategy class name. `null` inherits the store setting."},"preferred_storefront_access":{"type":"string","nullable":true,"enum":["public","prices_hidden","login_required"],"description":"Anonymous-visitor access posture. `null` inherits the store setting."},"preferred_guest_checkout":{"type":"boolean","nullable":true,"description":"Whether guests can check out without an account. `null` inherits the store setting."}}}}}}}},"/api/v3/admin/channels/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"channel found","content":{"application/json":{}}}}},"patch":{"summary":"Update a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"channel updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string"},"active":{"type":"boolean"},"default":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string","nullable":true,"description":"Routing strategy class name. `null` inherits the store setting."},"preferred_storefront_access":{"type":"string","nullable":true,"enum":["public","prices_hidden","login_required"],"description":"Anonymous-visitor access posture. `null` inherits the store setting."},"preferred_guest_checkout":{"type":"boolean","nullable":true,"description":"Whether guests can check out without an account. `null` inherits the store setting."}}}}}}},"delete":{"summary":"Delete a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"channel deleted"}}}},"/api/v3/admin/channels/{id}/add_products":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Publish products on a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes the listed products on this channel. Idempotent — re-publishing\nan already-published product updates its publication window. Products from\nsibling stores are silently dropped.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products published","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["product_ids"],"properties":{"product_ids":{"type":"array","items":{"type":"string"}},"published_at":{"type":"string","format":"date-time","nullable":true,"description":"When the publications go live. `null` means immediately."},"unpublished_at":{"type":"string","format":"date-time","nullable":true,"description":"When the publications come down. `null` means never."}}}}}}}},"/api/v3/admin/channels/{id}/remove_products":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Unpublish products from a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Unpublishes the listed products from this channel.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products unpublished","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["product_ids"],"properties":{"product_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/channels/{channel_id}/order_routing_rules":{"parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List order routing rules for a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the channel's routing rules in priority order. The rules engine walks them top-down; see the Order Routing guide.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules found","content":{"application/json":{}}}}},"post":{"summary":"Create an order routing rule on a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a rule to the channel's routing list. The `type` is the wire shorthand from `GET /order_routing_rules/types` (e.g. `preferred_location`). Omitting `position` appends the rule at the end of the list. Each rule kind can appear at most once per channel — a duplicate `type` is rejected with a validation error.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"rule created","content":{"application/json":{}}},"422":{"description":"unknown rule type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"active":{"type":"boolean"},"position":{"type":"integer"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/channels/{channel_id}/order_routing_rules/{id}":{"parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update an order routing rule","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a rule's `active` flag, `position` (the list reorders around it), or `preferences`. The rule kind cannot be changed — delete and re-create instead.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"},"position":{"type":"integer"},"preferences":{"type":"object","additionalProperties":true}}}}}}},"delete":{"summary":"Delete an order routing rule","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"rule deleted"}}}},"/api/v3/admin/order_routing_rules/types":{"get":{"summary":"List available order routing rule types","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Enumerates the registered rule kinds with their labels, descriptions and preference schemas — drives the \"Add rule\" picker in the admin dashboard. Plugins extend the list by registering `Spree::OrderRoutingRule` subclasses via `Spree.order_routing.rules`.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"types found","content":{"application/json":{}}}}}},"/api/v3/admin/custom_field_definitions":{"get":{"summary":"List custom field definitions","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all defined custom fields. Filter by `?q[resource_type_eq]=Spree::Product` to narrow to one parent type.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,label,field_type). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"definitions returned","content":{"application/json":{}}}}},"post":{"summary":"Create a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"definition created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["key","field_type","resource_type"],"properties":{"namespace":{"type":"string","description":"Defaults to `custom`"},"key":{"type":"string"},"label":{"type":"string","description":"Human-readable name; defaults to titleized `key`"},"field_type":{"type":"string","description":"Custom field type identifier (one of the registered field-type class names)."},"resource_type":{"type":"string","description":"Owner class, e.g. `Spree::Product`"},"storefront_visible":{"type":"boolean","description":"When false, the definition is admin-only and never exposed in the Store API"},"searchable":{"type":"boolean","description":"When true, values are included in storefront product text search"},"sortable":{"type":"boolean","description":"When true, storefront product listings can sort by this field"}}}}}}}},"/api/v3/admin/custom_field_definitions/{id}":{"get":{"summary":"Show a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,label,field_type). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"definition found","content":{"application/json":{}}}}},"patch":{"summary":"Update a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"definition updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"storefront_visible":{"type":"boolean"},"searchable":{"type":"boolean"},"sortable":{"type":"boolean"}}}}}}},"delete":{"summary":"Delete a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes the definition and cascades to all custom field values referencing it.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"definition deleted"}}}},"/api/v3/admin/customer_groups":{"get":{"summary":"List customer groups","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer groups configured for the current store. Groups\nsegment customers for targeted promotions (see the `customer_group`\npromotion rule) and reporting. The list endpoint never embeds the\nmember list — fetch a single group with `?expand=customers` if you\nneed them inline, or query `/admin/customers?customer_group_id_in=…`\nfor paginated membership.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer groups found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a customer group in the current store. `customer_ids` is\noptional; when present, customers are attached at create time.\nPass prefixed IDs (e.g. `cus_…`) — the server decodes them\nautomatically.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"customer group created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"customer_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customer_groups/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Customer group prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single customer group. Pass `?expand=customers` to embed\nthe full member list inline (recommended only for single-record\nreads — embed cost scales with membership size).\n\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `customers`.","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer group with embedded customers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"404":{"description":"customer group not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name, description, or membership. `customer_ids` is a\nfull-set replacement — the server reconciles the membership to\nmatch the array, adding new IDs and removing ones not present.\nSend `customer_ids: []` to clear all members.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customer group updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"customer_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the group. Member users are not deleted; their `customer_group_users` rows are dropped.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"customer group deleted"}}}},"/api/v3/admin/customers/{customer_id}/addresses":{"get":{"summary":"List customer addresses","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer's saved addresses.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., country, state). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., first_name,last_name,address1,city). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"addresses found","content":{"application/json":{}}}}},"post":{"summary":"Create a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new address to the customer's address book. Pass `is_default_billing: true` or `is_default_shipping: true` to set as the default — the previous default loses its flag in the same transaction.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"address created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"address2":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_iso":{"type":"string","description":"ISO-2 country code (e.g. US)"},"state_code":{"type":"string","description":"State/province abbreviation (e.g. NY)"},"phone":{"type":"string"},"company":{"type":"string"},"label":{"type":"string"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"}}}}}}}},"/api/v3/admin/customers/{customer_id}/addresses/{id}":{"patch":{"summary":"Update a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a customer address.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"address updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"city":{"type":"string"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"}}}}}}},"delete":{"summary":"Delete a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes the address. If it was a default, the customer loses that default (no auto-promotion).\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"address deleted"}}}},"/api/v3/admin/customers/{customer_id}/credit_cards":{"get":{"summary":"List customer credit cards","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer's saved credit cards. Useful for off-session admin charges via `POST /admin/orders/:id/payments { source_id }`.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., brand,last4,month,year). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"credit cards found","content":{"application/json":{}}}}}},"/api/v3/admin/customers/{customer_id}/credit_cards/{id}":{"get":{"summary":"Show a customer credit card","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a saved credit card by ID.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., brand,last4,month,year). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"credit card found","content":{"application/json":{}}}}},"delete":{"summary":"Delete a customer credit card","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a saved credit card.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"credit card deleted"}}}},"/api/v3/admin/customers/{customer_id}/store_credits":{"get":{"summary":"List customer store credits","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns store credits issued to the customer.\n\n**Required scope:** `read_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., category, store, created_by). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,amount_used,memo,currency). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credits found","content":{"application/json":{}}}}},"post":{"summary":"Issue a store credit to a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"`created_by` is set automatically from the authenticated admin.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"store credit created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["amount","currency","category_id"],"properties":{"amount":{"type":"string"},"currency":{"type":"string"},"category_id":{"type":"string","description":"StoreCreditCategory ID"},"memo":{"type":"string"}}}}}}}},"/api/v3/admin/customers/{customer_id}/store_credits/{id}":{"patch":{"summary":"Update a store credit","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Update memo / category / amount. The amount can only be changed if `amount_used == 0`.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"store credit updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string"},"category_id":{"type":"string"},"memo":{"type":"string"}}}}}}},"delete":{"summary":"Delete a store credit","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an unused store credit (amount_used == 0). Returns 422 otherwise.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"store credit deleted"}}}},"/api/v3/admin/customers":{"get":{"summary":"List customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of customers. Supports Ransack search/filters.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[search]","in":"query","required":false,"description":"Email + name full-text-ish search","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., addresses, store_credits). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., email,first_name,last_name). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customers found","content":{"application/json":{}}}}},"post":{"summary":"Create a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a customer. No welcome email is sent automatically.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"customer created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"},"accepts_email_marketing":{"type":"boolean"},"internal_note":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"}}}}}}}},"/api/v3/admin/customers/{id}":{"get":{"summary":"Show a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns full customer details including computed order stats (orders_count, total_spent, last_order_completed_at).\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Customer ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations: addresses, orders, store_credits, default_billing_address, default_shipping_address","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., email,first_name,last_name). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer found","content":{"application/json":{}}}}},"patch":{"summary":"Update a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates customer attributes. `tags` replaces the full set.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customer updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"},"accepts_email_marketing":{"type":"boolean"},"internal_note":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"}}}}}}},"delete":{"summary":"Delete a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a customer. Returns 422 if the customer has any orders.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"customer deleted"}}}},"/api/v3/admin/customers/bulk_add_to_groups":{"post":{"summary":"Bulk-add customers to groups","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each customer in `ids` to every group in `customer_group_ids`.\nIdempotent — customers already in a group are skipped server-side.\nGroups from sibling stores are silently ignored. Returns counts of\ncustomers and groups that were processed (post store-scoping).\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customers added to groups","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"customer_group_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","customer_group_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_remove_from_groups":{"post":{"summary":"Bulk-remove customers from groups","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each customer in `ids` from every group in `customer_group_ids`.\nNo-op for non-members. Groups from sibling stores are silently ignored.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customers removed from groups","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"customer_group_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","customer_group_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_add_tags":{"post":{"summary":"Bulk-add tags to customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds each tag name in `tags` to every customer in `ids`. Tags are\nupserted by name; re-adding an existing tag is a no-op.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags added","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_remove_tags":{"post":{"summary":"Bulk-remove tags from customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes each tag name in `tags` from every customer in `ids`. No-op\nfor customers that don't carry the tag.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags removed","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/exports":{"get":{"summary":"List exports","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns CSV exports queued or completed for the current store. Polled by the admin SPA to detect when an export finishes (`done: true`).\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"exports found","content":{"application/json":{}}}}},"post":{"summary":"Create an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Queues a CSV export. The `type` selects the dataset; `search_params` is an\noptional Ransack query (same shape used by the `q[...]` params on list endpoints)\nthat filters which records are exported. Pass `record_selection: \"all\"` to\nclear the filter server-side and export everything in scope.\n\nGeneration is asynchronous. Poll `GET /admin/exports/{id}` until `done` is `true`,\nthen redirect the browser to `download_url` to fetch the file.\n\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"export queued","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["products","orders","customers","product_translations","gift_cards","coupon_codes","newsletter_subscribers"]},"record_selection":{"type":"string","enum":["filtered","all"],"description":"Set to \"all\" to ignore search_params and export everything in scope."},"search_params":{"type":"object","description":"Ransack query hash. Same predicates accepted by the list endpoint.","additionalProperties":true},"results_url":{"type":"string","description":"Absolute URL of your admin exports view; the export-done email uses it as the download button target. Only honored when it matches one of the store's configured allowed origins."}}}}}}}},"/api/v3/admin/exports/{id}":{"get":{"summary":"Show an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns export status. While `done` is `false`, the SPA continues polling.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"export found","content":{"application/json":{}}}}},"delete":{"summary":"Delete an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the export and purges its attachment.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"export deleted"}}}},"/api/v3/admin/exports/{id}/download":{"get":{"summary":"Download an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the exported CSV with `Content-Disposition: attachment`. Returns 422 with `code: export_not_ready` while `done` is still `false`. The endpoint is JWT/API-key protected, so SPA clients must fetch it (with `Authorization` header) and trigger the browser download via a Blob URL — a top-level navigation cannot carry the JWT.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments":{"get":{"summary":"List fulfillments","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all shipments for an order.\n\n**Required scope:** `read_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., inventory_units, stock_location, shipping_rates). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,status,tracking,cost). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillments found","content":{"application/json":{}}}}},"post":{"summary":"Create a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Manually creates a fulfillment on a completed order, bypassing order routing — for example to mirror a shipment handled by an external carrier or 3PL. Moves the requested line item quantities out of their current fulfillments; when `items` is omitted, every not-yet-shipped unit is moved. Pass `status: 'shipped'` to register an already-shipped fulfillment (fires shipped webhooks and freezes cost/carrier). When `delivery_method_id` is omitted, the fulfillment inherits the delivery method and cost of the source fulfillment(s) it fully drains — keeping the order total unchanged; partially drained splits get no carrier when shipped, and pending fulfillments are otherwise (re)priced by the standard rate engine, which selects the lowest-cost available rate. Pass `cost` to set an explicit shipping cost instead (e.g. the 3PL price) — note this changes the order total and payment state, and is guaranteed to persist only with `status: 'shipped'` (pending fulfillments are re-priced by the rate engine).\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"fulfillment created","content":{"application/json":{}}},"422":{"description":"order not completed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["stock_location_id"],"properties":{"stock_location_id":{"type":"string","description":"Stock location the fulfillment ships from"},"tracking":{"type":"string","description":"Carrier tracking number, or a full https:// tracking link — a full URL is served back as tracking_url unchanged instead of being templated into the delivery method tracking URL"},"delivery_method_id":{"type":"string","description":"Delivery method (carrier) to attach as the selected rate. Defaults to the delivery method of the fully drained source fulfillment(s)"},"cost":{"type":"string","description":"Explicit shipping cost. Defaults to the summed cost of the fully drained source fulfillment(s), which keeps the order total unchanged; an explicit cost changes the order total and payment state. Guaranteed to persist only with status: 'shipped' — pending fulfillments are re-priced by the rate engine"},"status":{"type":"string","enum":["shipped"],"description":"Pass 'shipped' to register the fulfillment as already shipped"},"items":{"type":"array","description":"Line item quantities to fulfill. Omit to fulfill every not-yet-shipped unit.","items":{"type":"object","required":["item_id","quantity"],"properties":{"item_id":{"type":"string","description":"Line item ID"},"quantity":{"type":"integer"}}}},"metadata":{"type":"object","additionalProperties":true}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}":{"get":{"summary":"Show a shipment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific shipment.\n\n**Required scope:** `read_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., inventory_units, stock_location, shipping_rates). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,status,tracking,cost). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"shipment found","content":{"application/json":{}}}}},"patch":{"summary":"Update a shipment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a fulfillment (tracking, delivery rate).\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"shipment updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tracking":{"type":"string","description":"Carrier tracking number, or a full https:// tracking link served back as tracking_url unchanged"},"selected_delivery_rate_id":{"type":"string","description":"Delivery rate ID (dr_...) to select"}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/fulfill":{"patch":{"summary":"Fulfill a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Marks a fulfillment as fulfilled.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment fulfilled","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/purchase_label":{"patch":{"summary":"Buy the shipping label","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Buys the shipping label for a parcel that has not shipped yet — print it, pack the box, then mark the fulfillment fulfilled. Only delivery methods whose provider produces labels accept this.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"label purchased","content":{"application/json":{}}},"422":{"description":"provider does not produce labels","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/mark_delivered":{"patch":{"summary":"Mark a fulfillment delivered","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Records that the customer received the goods. Only a fulfilled shipment can be marked delivered.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment delivered","content":{"application/json":{}}},"422":{"description":"fulfillment has not shipped","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"delivered_at":{"type":"string","format":"date-time","description":"When the goods arrived. Defaults to now."},"notify_customer":{"type":"boolean","description":"Whether the customer gets a delivery notification. Defaults to true."}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/cancel":{"patch":{"summary":"Cancel a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Cancels a fulfillment.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment canceled","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/resume":{"patch":{"summary":"Resume a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Resumes a canceled fulfillment.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment resumed","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/split":{"patch":{"summary":"Split a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Transfers items from this shipment to a new shipment at a different stock location.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment split","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id","quantity"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"stock_location_id":{"type":"string","description":"Target stock location ID"}}}}}}}},"/api/v3/admin/gift_card_batches":{"get":{"summary":"List gift card batches","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the gift card batches issued by the current store. Each batch\ngroups the cards generated together for a campaign or bulk-issuance\n— the cards themselves live under `/admin/gift_cards` and reference\nthe batch via `gift_card_batch_id`.\n\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Records per page","schema":{"type":"integer"}},{"name":"q[prefix_cont]","in":"query","required":false,"description":"Filter by prefix (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift card batches found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GiftCardBatch"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a gift card batch","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a batch of gift cards in a single call. The server generates\n`codes_count` cards inline for small batches (configurable via\n`Spree.config.gift_card_batch_web_limit`, default 500) or enqueues\na background job for larger ones. Each card's code is the batch\n`prefix` followed by random hex.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"gift card batch created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCardBatch"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["prefix","amount","codes_count"],"properties":{"prefix":{"type":"string","description":"Lowercased and prepended to every generated code."},"amount":{"type":"string","description":"Decimal amount per card, greater than zero."},"currency":{"type":"string","description":"ISO 4217 currency code. Defaults to the store currency."},"codes_count":{"type":"integer","description":"Number of cards to generate. Capped at `gift_card_batch_limit`."},"expires_at":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/gift_card_batches/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Gift card batch prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a gift card batch","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single batch.\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"gift card batch found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCardBatch"}}}},"404":{"description":"gift card batch not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/gift_cards":{"get":{"summary":"List gift cards","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the gift cards issued by the current store. Filter by\n`q[code_cont]` for code search, `q[user_id_eq]` for cards issued\nto a specific customer, or `q[state_eq]` for status filtering.\n\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[code_cont]","in":"query","required":false,"description":"Filter by gift card code (contains)","schema":{"type":"string"}},{"name":"q[state_eq]","in":"query","required":false,"description":"Filter by status (active, redeemed, partially_redeemed, canceled)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift cards found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a gift card scoped to the current store. The code is\nauto-generated when omitted. `currency` defaults to the store's\nconfigured currency. Pass `user_id` (prefixed ID) to attach the\ncard to a specific customer.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"gift card created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["amount"],"properties":{"amount":{"type":"string","description":"Decimal amount, greater than zero."},"currency":{"type":"string","description":"ISO 4217 currency code. Defaults to the store currency."},"code":{"type":"string","description":"Optional caller-supplied code. Auto-generated when omitted."},"expires_at":{"type":"string","description":"ISO 8601 date.","nullable":true},"user_id":{"type":"string","description":"Optional customer prefixed ID.","nullable":true}}}}}}}},"/api/v3/admin/gift_cards/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Gift card prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single gift card.\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift card found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}},"404":{"description":"gift card not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an active gift card's editable attributes. Redeemed or\npartially-redeemed cards cannot be edited.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"gift card updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string"},"expires_at":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an unused gift card. Cards that have been redeemed or\npartially redeemed cannot be deleted and return 422.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"gift card deleted"},"422":{"description":"redeemed gift card cannot be deleted","content":{"application/json":{}}}}}},"/api/v3/admin/imports":{"get":{"summary":"List imports","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns CSV imports queued or completed for the current store.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"imports found","content":{"application/json":{}}}}},"post":{"summary":"Create an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Queues a CSV import. Upload the file first via `POST /api/v3/admin/direct_uploads`\nand pass the returned `signed_id` as `attachment`. On success the import is in the\n`mapping` state and the response carries the mapping payload: `schema_fields`\n(the canonical columns for the type), `csv_headers`, a `sample_row`, and the\nauto-assigned `mappings`.\n\nAdjust mappings if needed, then call `PATCH /admin/imports/{id}/complete_mapping`\nto start processing. Poll `GET /admin/imports/{id}` while `status` is\n`completed_mapping`/`processing`; terminal statuses are `completed` and `failed`.\n\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"import created in mapping state","content":{"application/json":{}}},"422":{"description":"unknown import type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["type","attachment"],"properties":{"type":{"type":"string","enum":["products","customers","product_translations"]},"attachment":{"type":"string","description":"ActiveStorage signed blob id from POST /api/v3/admin/direct_uploads."},"preferred_delimiter":{"type":"string","enum":[",",";","|","\t"],"description":"CSV column separator. Defaults to a comma."},"results_url":{"type":"string","description":"Absolute URL of your admin imports view; the import-done email links back to it with `?import=<id>` appended. Only honored when it matches one of the store's configured allowed origins."}}}}}}}},"/api/v3/admin/imports/template":{"get":{"summary":"Download an import template","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a CSV header row for the given import type, including the custom field columns available for the model.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"description":"Registered import type, e.g. products.","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV template","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/imports/example":{"get":{"summary":"Download an example import file","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Redirects to a populated example CSV for the given import type — the same sample data `rake spree:load_sample_data` uses, pinned to the installed Spree version. Returns 404 for a type that ships no example file.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"description":"Registered import type, e.g. products.","schema":{"type":"string"}}],"responses":{"302":{"description":"Redirect to the example CSV"}}}},"/api/v3/admin/imports/{id}":{"get":{"summary":"Show an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns import status and row counters. The admin dashboard polls this endpoint while `status` is `completed_mapping` or `processing`; `rows_count`, `completed_rows_count` and `failed_rows_count` drive the progress bar. The mapping payload (`csv_headers`, `sample_row`) is only present while `status` is `mapping`.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"import found","content":{"application/json":{}}}}},"delete":{"summary":"Delete an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the import, its rows and the uploaded file. Returns 422 while the import is being processed.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"import deleted"}}}},"/api/v3/admin/imports/{id}/download":{"get":{"summary":"Download the originally uploaded file","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the CSV exactly as it was uploaded — the audit trail for what was imported. JWT/API-key protected; SPA clients fetch it with the Authorization header and trigger the browser download via a Blob URL.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/imports/{id}/complete_mapping":{"patch":{"summary":"Complete mapping and start processing","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies the submitted column mappings, then starts row processing. Omit `mappings`\nto accept the auto-assigned ones from the create response. Returns 422 when a\nrequired schema field is left unmapped (`details.missing_required_fields`) or a\nfile column is assigned twice.\n\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"mapping completed, processing queued","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"mappings":{"type":"array","description":"Column assignments to apply before starting. `file_column: null` unmaps a field.","items":{"type":"object","required":["schema_field"],"properties":{"schema_field":{"type":"string"},"file_column":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/imports/{id}/retry_failed_rows":{"patch":{"summary":"Retry failed rows","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Re-processes the rows that failed. The import re-enters `processing`; poll `GET /admin/imports/{id}` until it completes again. Returns 422 when the import is not `completed` or has no failed rows.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"retry queued","content":{"application/json":{}}}}}},"/api/v3/admin/imports/{import_id}/rows":{"get":{"summary":"List import rows","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Paginated rows of an import — the failure report. Filter with `q[status_eq]=failed` to list only rows that could not be imported; each row carries the raw CSV `data` and its `validation_errors`.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"import_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"description":"Filter rows by status: pending, processing, completed, failed.","schema":{"type":"string"}}],"responses":{"200":{"description":"rows found","content":{"application/json":{}}}}}},"/api/v3/admin/markets":{"get":{"summary":"List markets","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the markets configured for the current store. Markets are\nstore-scoped and ordered by `position` (an `acts_as_list` column —\nupdate the order via `PATCH /markets/{id}` with `position`).\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `countries`.","schema":{"type":"string"}}],"responses":{"200":{"description":"markets found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Market"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new market for the current store.\n\n- `country_isos` accepts 2-letter ISO country codes (e.g. `[\"DE\", \"FR\"]`);\n the market must contain at least one country. Unknown codes are\n silently dropped.\n- `supported_locales` accepts an array of locale codes; the\n `default_locale` is always implicitly included.\n- Setting `default: true` automatically demotes the previous default\n market in the store.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"market created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"currency":{"type":"string","description":"ISO 4217 currency code."},"default_locale":{"type":"string","description":"IETF locale tag used as the market default."},"supported_locales":{"type":"array","items":{"type":"string"},"description":"Locale codes available in this market. The default is always implicitly included."},"tax_inclusive":{"type":"boolean","default":false,"description":"Display prices with tax included."},"default":{"type":"boolean","default":false,"description":"Setting to true demotes the previous default."},"position":{"type":"integer","description":"Sort order within the store; lower = first."},"country_isos":{"type":"array","items":{"type":"string"},"description":"2-letter ISO country codes assigned to this market. At least one is required."}},"required":["name","currency","default_locale","country_isos"]}}}}}},"/api/v3/admin/markets/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"market found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"404":{"description":"market not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing market. Pass `country_isos` to replace the\nmarket's country list (full-set update), `supported_locales` to\nreplace the supported locales, or `position` to reorder the market\nwithin the store.\n\nSetting `default: true` automatically demotes the previous default.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"market updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"currency":{"type":"string"},"default_locale":{"type":"string"},"supported_locales":{"type":"array","items":{"type":"string"}},"tax_inclusive":{"type":"boolean"},"default":{"type":"boolean"},"position":{"type":"integer"},"country_isos":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the market (sets `deleted_at`). The default market and\nthe last remaining market in a store cannot be deleted — both return\n422 with a `validation_error`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"market deleted"},"422":{"description":"cannot delete default or last market","content":{"application/json":{}}}}}},"/api/v3/admin/option_types":{"get":{"summary":"List option types","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of option types.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,label,position). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"option types found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OptionType"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new option type. Supports nested option values.\n\nOption values can be provided inline and will be created or updated by name.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"option type created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"},"filterable":{"type":"boolean"},"option_values":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"}}}}},"required":["name","label"]}}}}}},"/api/v3/admin/option_types/{id}":{"get":{"summary":"Get an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single option type by ID, including its option values.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,label,position). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"option type found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"404":{"description":"option type not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an option type. Supports updating nested option values.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}}],"responses":{"200":{"description":"option type updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"},"filterable":{"type":"boolean"},"option_values":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Existing option value ID to update"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"}}}}}}}}}},"delete":{"summary":"Delete an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an option type.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}}],"responses":{"204":{"description":"option type deleted"}}}},"/api/v3/admin/orders/{order_id}/tax_lines":{"get":{"summary":"List tax lines","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Typed tax rows on the order. Read-only — written exclusively by the tax provider.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"200":{"description":"tax lines found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/discounts":{"get":{"summary":"List discounts","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Typed discount rows (promotion-sourced and manual) on the order.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"200":{"description":"discounts found","content":{"application/json":{}}}}},"post":{"summary":"Create manual discount","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a manual discount. With line_item_id a single row is created; without it the amount is distributed across line items (largest remainder). This is the sanctioned post-placement discount path and works on completed orders.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"201":{"description":"discount created","content":{"application/json":{}}},"422":{"description":"invalid discount","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"value":{"type":"number"},"value_type":{"type":"string","enum":["flat","percent"]},"line_item_id":{"type":"string","nullable":true,"description":"Target line item; omit to distribute order-level"}},"required":["label","value"]}}}}}},"/api/v3/admin/orders/{order_id}/fees":{"post":{"summary":"Create fee","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a fee (surcharge, handling, gift wrap, COD, payment fee). Order-level when no target is given. Works on completed orders.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"201":{"description":"fee created","content":{"application/json":{}}},"422":{"description":"invalid fee","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"number"},"kind":{"type":"string","enum":["surcharge","handling","gift_wrap","cod","payment"],"description":"Defaults to 'surcharge'"},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true}},"required":["label","amount"]}}}}}},"/api/v3/admin/orders/{order_id}/gift_cards":{"post":{"summary":"Apply a gift card to an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies a gift card by code to the order. Returns the gift card.\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"gift card applied","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["code"],"properties":{"code":{"type":"string","description":"Gift card code"}}}}}}}},"/api/v3/admin/orders/{order_id}/gift_cards/{id}":{"delete":{"summary":"Remove a gift card from an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the gift card from the order.\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Gift card ID","schema":{"type":"string"}}],"responses":{"204":{"description":"gift card removed"}}}},"/api/v3/admin/orders/{order_id}/items":{"get":{"summary":"List order items","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all line items for an order.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variant, variant.product). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., quantity,price,total). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"items found","content":{"application/json":{}}}}},"post":{"summary":"Add an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new line item to the order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"item added","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id"],"properties":{"variant_id":{"type":"string","description":"Prefixed variant ID"},"quantity":{"type":"integer","default":1}}}}}}}},"/api/v3/admin/orders/{order_id}/items/{id}":{"get":{"summary":"Show an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific line item.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variant, variant.product). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., quantity,price,total). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"item found","content":{"application/json":{}}}}},"patch":{"summary":"Update an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an order item quantity or metadata.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}}],"responses":{"200":{"description":"item updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"integer"}}}}}}},"delete":{"summary":"Remove an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes an item from the order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}}],"responses":{"204":{"description":"line item removed"}}}},"/api/v3/admin/orders/{order_id}/store_credits":{"post":{"summary":"Apply customer's store credit to an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies the order customer's available store credit. When `amount` is omitted, applies up to the order outstanding balance.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"store credit applied","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string","description":"Optional explicit amount; defaults to order outstanding balance"}}}}}}},"delete":{"summary":"Remove store credit from an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes any applied store credit from the order.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"204":{"description":"store credit removed"}}}},"/api/v3/admin/orders":{"get":{"summary":"List orders","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of orders for the current store.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"sort","in":"query","required":false,"description":"Sort field (e.g., created_at, -created_at, completed_at)","schema":{"type":"string"}},{"name":"q[state_eq]","in":"query","required":false,"description":"Filter by state (cart, address, delivery, payment, confirm, complete, canceled)","schema":{"type":"string"}},{"name":"q[email_cont]","in":"query","required":false,"description":"Filter by email (contains)","schema":{"type":"string"}},{"name":"q[number_eq]","in":"query","required":false,"description":"Filter by order number","schema":{"type":"string"}},{"name":"q[completed_at_gt]","in":"query","required":false,"description":"Filter by completed after date","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., items, fulfillments, payments, customer, discounts, billing_address, shipping_address). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,total,status,completed_at). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"orders found","content":{"application/json":{}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a draft order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new draft order in one shot. Customer, items, addresses, currency,\nmarket, channel, locale, notes, metadata, and a coupon code can all be\nprovided inline.\n\nSetting `preferred_stock_location_id` pins the order's preferred fulfillment\nlocation — Order Routing's built-in `PreferredLocation` rule consumes it\nwhen picking which stock location ships each shipment.\n\nInvalid coupon codes are non-fatal — the order is created and the failure\nis reported on the service result (not in the API response body for now).\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"order created with preferred_stock_location_id","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"customer_id":{"type":"string","description":"Customer ID. Alias: user_id (legacy)."},"use_customer_default_address":{"type":"boolean","description":"When true with customer_id, copies the customer's saved billing/shipping addresses onto the order."},"currency":{"type":"string"},"market_id":{"type":"string","description":"Market ID"},"channel_id":{"type":"string","description":"Channel ID. Defaults to the store primary channel when omitted."},"preferred_stock_location_id":{"type":"string","description":"Stock Location ID to prefer for fulfillment. Order Routing's built-in PreferredLocation rule reads this and ranks the location first; routing falls back to the next rule when the preferred location can't cover the cart."},"locale":{"type":"string"},"customer_note":{"type":"string","description":"Public, customer-visible note"},"internal_note":{"type":"string","description":"Staff-only note"},"metadata":{"type":"object","description":"Arbitrary key/value metadata"},"shipping_address":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_iso":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"shipping_address_id":{"type":"string","description":"Existing customer address ID"},"billing_address":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_iso":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"billing_address_id":{"type":"string","description":"Existing customer address ID"},"items":{"type":"array","items":{"type":"object","required":["variant_id","quantity"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"metadata":{"type":"object"}}}},"coupon_code":{"type":"string","description":"Optional. Applied non-fatally; invalid codes do not block creation."}}}}}}}},"/api/v3/admin/orders/{id}":{"get":{"summary":"Show an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns full order details including admin-only fields.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID (e.g., or_xxx)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., items, fulfillments, payments, customer, discounts, billing_address, shipping_address). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,total,status,completed_at). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"order found","content":{"application/json":{}}},"404":{"description":"order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an order. Supports updating email, addresses, special instructions, and line items.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"customer_note":{"type":"string"},"internal_note":{"type":"string"},"channel_id":{"type":"string","description":"Channel ID"},"preferred_stock_location_id":{"type":"string","description":"Stock Location ID to prefer for fulfillment. Re-runs Order Routing's PreferredLocation rule on subsequent shipment rebuilds."},"ship_address":{"type":"object","properties":{"firstname":{"type":"string"},"lastname":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"zipcode":{"type":"string"},"country_iso":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"bill_address":{"type":"object","properties":{"firstname":{"type":"string"},"lastname":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"zipcode":{"type":"string"},"country_iso":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"items":{"type":"array","items":{"type":"object","required":["variant_id"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"metadata":{"type":"object"}}}}}}}}}},"delete":{"summary":"Delete a draft order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a draft order. Completed orders cannot be deleted.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"204":{"description":"order deleted"}}}},"/api/v3/admin/orders/{id}/complete":{"patch":{"summary":"Complete an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Completes an order in the `confirm` state, marking it as placed.\n\nSet `notify_customer: true` to send the order confirmation email.\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order completed","content":{"application/json":{}}},"422":{"description":"order cannot be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"notify_customer":{"type":"boolean","description":"Send the order confirmation email after completion."}}}}}}}},"/api/v3/admin/orders/{id}/cancel":{"patch":{"summary":"Cancel an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Cancels a completed order.\n\nSet `notify_customer: true` to send the order cancellation email.\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order canceled","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"notify_customer":{"type":"boolean","description":"Send the order cancellation email after canceling."}}}}}}}},"/api/v3/admin/orders/{id}/approve":{"patch":{"summary":"Approve an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Approves an order (e.g., for fraud review).\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order approved","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{id}/resume":{"patch":{"summary":"Resume a canceled order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Resumes a previously canceled order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order resumed","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{id}/resend_confirmation":{"post":{"summary":"Resend confirmation email","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes the order.completed event to trigger confirmation email delivery.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"confirmation resent","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods":{"get":{"summary":"List payment methods","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's configured payment methods. Use `source_required: true` to know which methods need a saved source.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,type,active). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment methods found","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods/types":{"get":{"summary":"List available payment provider types","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PaymentMethod subclasses that can be used to create new payment methods. Useful for populating a \"Provider\" dropdown in admin UIs.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"provider types found","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods/{id}":{"get":{"summary":"Show a payment method","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a payment method by ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,type,active). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment method found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/payments":{"get":{"summary":"List payments","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all payments for an order.\n\n**Required scope:** `read_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method, source). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,status,number,response_code). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payments found","content":{"application/json":{}}}}},"post":{"summary":"Create a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new payment for the order.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"payment created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["payment_method_id"],"properties":{"payment_method_id":{"type":"string","description":"Payment method ID"},"amount":{"type":"string"},"source_id":{"type":"string","description":"Payment source ID"}}}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}":{"get":{"summary":"Show a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific payment.\n\n**Required scope:** `read_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method, source). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,status,number,response_code). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}/capture":{"patch":{"summary":"Capture a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Captures a pending payment.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"payment captured","content":{"application/json":{}}},"422":{"description":"capture failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}/void":{"patch":{"summary":"Void a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Voids a payment.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"payment voided","content":{"application/json":{}}}}}},"/api/v3/admin/price_lists":{"get":{"summary":"List price lists","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the price lists configured for the current store.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `price_rules`.","schema":{"type":"string"}}],"responses":{"200":{"description":"price lists found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PriceList"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new draft price list.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"price list created (server-to-server — rules + prices, no product_ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer"},"product_ids":{"type":"array","items":{"type":"string"},"description":"Prefixed product ids to seed the list with."},"rules":{"type":"array","description":"STI-typed price rules to attach on create. Existing rules on the same payload via PATCH reconcile by id.","items":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"prices":{"type":"array","description":"Server-to-server alternative to `product_ids`: ship the exact per-variant prices the list should contain. Each row upserts on the unique key `(variant_id, currency, price_list_id)`. Mix-and-match with `product_ids` is supported but typically unnecessary — `prices` alone tells the server which variants belong to the list and what the override amount is.","items":{"type":"object","required":["variant_id","currency"],"properties":{"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/price_lists/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"404":{"description":"price list not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a price list. The optional `rules:` array reconciles nested\nSTI-typed price rules in a single round-trip — existing rules update\nby `id`, new rules build, missing rules destroy. Mirrors the\npromotion editor's \"save the whole thing on Save\" pattern.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list updated with nested rules","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer"},"product_ids":{"type":"array","items":{"type":"string"},"description":"Prefixed product ids — reconciles list membership (adds + removes)."},"rules":{"type":"array","items":{"type":"object","required":["type"],"properties":{"id":{"type":"string","nullable":true},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"prices":{"type":"array","description":"Individual price overrides (the spreadsheet payload). Each row updates by `id` if shipped, otherwise upserts on the unique key `(variant_id, currency, price_list_id)`.","items":{"type":"object","oneOf":[{"required":["id"]},{"required":["variant_id","currency"]}],"properties":{"id":{"type":"string"},"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}},"delete":{"summary":"Delete a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the price list. Associated prices are removed asynchronously.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"price list deleted"}}}},"/api/v3/admin/price_lists/{id}/activate":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Activate a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Transitions a draft / inactive list to `active`. If `starts_at` is\nin the future the list is marked `scheduled` instead, matching the\nlegacy admin behaviour.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list activated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}}}},"/api/v3/admin/price_lists/{id}/deactivate":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Deactivate a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list deactivated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}}}},"/api/v3/admin/prices":{"get":{"summary":"List prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Generic prices endpoint covering both base prices and price-list\noverrides. Filter with Ransack: `q[price_list_id_eq]=…`,\n`q[currency_eq]=USD`, `q[price_list_id_null]=true` (base prices only).\n\nThe admin spreadsheet uses this with server-side pagination so it\nscales past the metadata-PATCH path on `/price_lists/:id`.\n\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[price_list_id_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[price_list_id_null]","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"q[currency_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[variant_id_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Comma-separated sort keys. Supports e.g. `variant_product_name,variant_id`.","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `variant`.","schema":{"type":"string"}}],"responses":{"200":{"description":"prices found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Price"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a single price. Omit `price_list_id` to create a base price.\nFor more than a handful of rows, prefer `POST /admin/prices/bulk_upsert`.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"price created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id","currency"],"properties":{"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"price_list_id":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/prices/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}},"404":{"description":"price not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the price (acts_as_paranoid).\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"price deleted"}}}},"/api/v3/admin/prices/bulk_upsert":{"post":{"summary":"Bulk-upsert prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Upserts a batch of prices in a single SQL round trip.\n\nEach row either:\n* targets an existing price by `id`, OR\n* matches on the unique key `(variant_id, currency, price_list_id)` —\n updating the existing row if one exists, creating one otherwise.\n\nModel callbacks (e.g. PriceHistory) are bypassed; this is a\nbulk-write fast path for the admin spreadsheet. The response\ncarries `price_count` — the number of rows touched.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"prices upserted","content":{"application/json":{"schema":{"type":"object","properties":{"price_count":{"type":"integer"}}}}}},"422":{"description":"missing prices key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["prices"],"properties":{"prices":{"type":"array","items":{"type":"object","required":["variant_id","currency"],"properties":{"id":{"type":"string","nullable":true},"variant_id":{"type":"string"},"currency":{"type":"string"},"price_list_id":{"type":"string","nullable":true},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/prices/bulk_destroy":{"delete":{"summary":"Bulk-delete prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes each price in `ids`. Returns the count actually destroyed.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"prices deleted","content":{"application/json":{"schema":{"type":"object","properties":{"price_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/{product_id}/custom_fields":{"get":{"summary":"List product custom fields","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the product's custom field values.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., custom_field_definition). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,value,namespace). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"custom fields found","content":{"application/json":{}}}}},"post":{"summary":"Create a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sets a custom field value on the product. Requires an existing CustomFieldDefinition; pass its prefixed `cfdef_…` id.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"custom field created","content":{"application/json":{}}},"422":{"description":"duplicate definition for the same product","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["custom_field_definition_id","value"],"properties":{"custom_field_definition_id":{"type":"string","description":"Prefixed `cfdef_…` id"},"value":{"description":"Value matching the definition's `field_type`"}}}}}}}},"/api/v3/admin/products/{product_id}/custom_fields/{id}":{"get":{"summary":"Show a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., custom_field_definition). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,value,namespace). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"custom field found","content":{"application/json":{}}}}},"patch":{"summary":"Update a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates the custom field's `value`. The linked definition cannot be changed — delete and recreate to switch.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"custom field updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["value"],"properties":{"value":{"description":"New value"}}}}}}},"delete":{"summary":"Delete a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"custom field deleted"}}}},"/api/v3/admin/products/{product_id}/translations":{"get":{"summary":"List product translations","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the full translation matrix for the product: the source value and content type per translatable field, plus the translated value for every supported locale.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translations found","content":{"application/json":{}}}}}},"/api/v3/admin/products":{"get":{"summary":"List products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of products for the current store.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"sort","in":"query","required":false,"description":"Sort field (e.g., name, -name, price, -price, best_selling)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variants, media, option_types, categories). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,slug,price,status). id is always included.","schema":{"type":"string"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"description":"Filter by status","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new product. Supports nested variants with prices and option types.\n\nOption types and values are auto-created if they don't exist.\nPrices are upserted by currency. Stock items are upserted by stock location.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"product created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["draft","active","archived"]},"tax_category_id":{"type":"string","description":"Tax category ID"},"category_ids":{"type":"array","items":{"type":"string"},"description":"Array of category IDs"},"tags":{"type":"array","items":{"type":"string"}},"prices":{"type":"array","description":"Shorthand for a simple (no-options) product: per-currency prices that forward to the product's sole variant. For products with options, set prices per variant under `variants:` instead.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"variants":{"type":"array","description":"Array of variant payloads. Variants can declare multiple option pairs via `options:` and per-currency prices via `prices:`. Stock counts go in `stock_items:` (per stock location).","items":{"type":"object","properties":{"sku":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}},"required":["name"]}}}}}},"/api/v3/admin/products/{id}":{"get":{"summary":"Get a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single product by ID.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID (e.g., prod_xxx)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variants, media, option_types, categories). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,slug,price,status). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"product found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"404":{"description":"product not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a product. Only provided fields are updated.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"200":{"description":"product updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["draft","active","archived"]},"tax_category_id":{"type":"string","description":"Tax category ID"},"category_ids":{"type":"array","items":{"type":"string"},"description":"Array of category IDs"},"tags":{"type":"array","items":{"type":"string"}},"prices":{"type":"array","description":"Shorthand for a simple (no-options) product: per-currency prices that forward to the product's sole variant. For products with options, set prices per variant under `variants:` instead.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"variants":{"type":"array","description":"Array of variant payloads. Variants can declare multiple option pairs via `options:` and per-currency prices via `prices:`. Stock counts go in `stock_items:` (per stock location).","items":{"type":"object","properties":{"sku":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}}}}},"delete":{"summary":"Delete a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes a product.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product deleted"},"422":{"description":"deletion refused by a store rule","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/products/bulk_status_update":{"post":{"summary":"Bulk-update product status","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sets `status` on each product in `ids`. Reindexes the affected products\nfor search. Cross-store IDs are silently dropped. Returns counts.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"cross-store products silently dropped","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"status":{"type":"string"}}}}}},"422":{"description":"invalid status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","status"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["draft","active","archived"]}}}}}}}},"/api/v3/admin/products/bulk_add_to_categories":{"post":{"summary":"Bulk-add products to categories","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each product in `ids` to every category (category) in `category_ids`.\nCategories from sibling stores are silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products added to categories","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"category_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","category_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_categories":{"post":{"summary":"Bulk-remove products from categories","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each product in `ids` from every category in `category_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products removed from categories","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","category_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_to_collections":{"post":{"summary":"Bulk-add products to collections","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each product in `ids` to every manual collection in `collection_ids`.\nAutomatic (rule-based) and sibling-store collections are silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products added to collections","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"collection_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","collection_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"collection_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_collections":{"post":{"summary":"Bulk-remove products from collections","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each product in `ids` from every collection in `collection_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products removed from collections","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","collection_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"collection_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_to_channels":{"post":{"summary":"Bulk-add products to channels","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes each product in `ids` on every channel in `channel_ids`. Idempotent —\nre-publishing on an existing channel is a no-op. Channels from sibling stores\nare silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products published on channels","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"channel_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","channel_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"channel_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_channels":{"post":{"summary":"Bulk-remove products from channels","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Unpublishes each product in `ids` from every channel in `channel_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products unpublished from channels","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"channel_count":{"type":"integer"},"removed":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","channel_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"channel_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_tags":{"post":{"summary":"Bulk-add tags to products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds each tag name in `tags` to every product in `ids`. Tags are upserted by name.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags added","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_tags":{"post":{"summary":"Bulk-remove tags from products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes each tag in `tags` from every product in `ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags removed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_destroy":{"delete":{"summary":"Bulk-delete products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes each product in `ids`. Returns the count actually destroyed.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products deleted","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/promotions/{promotion_id}/coupon_codes":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List coupon codes for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the auto-generated coupon codes for a multi-code promotion. Single-code promotions store the code on the promotion itself; this endpoint returns an empty list for them.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"coupon codes found","content":{"application/json":{}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_actions":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List actions for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"actions found","content":{"application/json":{}}}}},"post":{"summary":"Create an action on a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new action to a promotion. The `type` is the wire shorthand from `GET /promotion_actions/types` (e.g. `free_shipping`, `create_item_adjustments`). Fully-qualified Ruby class names are also accepted for backward compatibility.\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"action created","content":{"application/json":{}}},"422":{"description":"unknown action type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_actions/{id}":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"delete":{"summary":"Delete an action from a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"action deleted"}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_rules":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List rules for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules found","content":{"application/json":{}}}}},"post":{"summary":"Create a rule on a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new rule to a promotion. The `type` is the wire shorthand from `GET /promotion_rules/types` (e.g. `currency`, `item_total`, `product`). Fully-qualified Ruby class names are also accepted for backward compatibility.\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"rule created with preferences","content":{"application/json":{}}},"422":{"description":"unknown rule type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_rules/{id}":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a rule's preferences","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"preferences":{"type":"object","additionalProperties":true}}}}}}},"delete":{"summary":"Delete a rule from a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"rule deleted"}}}},"/api/v3/admin/promotions":{"get":{"summary":"List promotions","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's promotions, including manual coupon and automatic promotions.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"promotions found","content":{"application/json":{}}}}},"post":{"summary":"Create a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new promotion. `code` is required for single-code coupon promotions;\npass `multi_codes: true` with `number_of_codes` to auto-generate a batch.\n\nRules and actions can be created in the same request by passing arrays of\n`{ type, preferences, ... }` rows. The server reconciles to the desired set:\nnew rows are built, existing rows (by `id`) are updated, omitted rows are removed.\n\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"promotion created with rules and actions","content":{"application/json":{}}},"422":{"description":"invalid params","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","format":"date-time","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"usage_limit":{"type":"integer","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"kind":{"type":"string","enum":["coupon_code","automatic"]},"multi_codes":{"type":"boolean"},"number_of_codes":{"type":"integer","nullable":true},"code_prefix":{"type":"string","nullable":true},"promotion_category_id":{"type":"string","nullable":true},"rules":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"product_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"customer_ids":{"type":"array","items":{"type":"string"}}},"required":["type"]}},"actions":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"calculator":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"required":["type"]}}},"required":["name"]}}}}}},"/api/v3/admin/promotions/{id}":{"get":{"summary":"Show a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"promotion found","content":{"application/json":{}}}}},"patch":{"summary":"Update a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a promotion. The `rules` and `actions` arrays are treated as\na *desired set* — rows with `id` update in place, rows without `id` are\nbuilt fresh, and any existing row not present in the array is destroyed.\nPass `rules: []` or `actions: []` to clear them.\n\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules and actions cleared with empty arrays","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"starts_at":{"type":"string","format":"date-time","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"usage_limit":{"type":"integer","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"kind":{"type":"string","enum":["coupon_code","automatic"]},"promotion_category_id":{"type":"string","nullable":true},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true,"description":"Pass to update an existing rule; omit to build a new one"},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"product_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"customer_ids":{"type":"array","items":{"type":"string"}}},"required":["type"]}},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"calculator":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"required":["type"]}}}}}}}},"delete":{"summary":"Delete a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"promotion deleted"}}}},"/api/v3/admin/promotion_actions/types":{"get":{"summary":"List available promotion action types","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PromotionAction subclasses with their preference schemas. Used by admin UIs to populate the \"Add action\" picker and render generic preference forms.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"action types found","content":{"application/json":{}}}}}},"/api/v3/admin/promotion_rules/types":{"get":{"summary":"List available promotion rule types","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PromotionRule subclasses with their preference schemas.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule types found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/refunds":{"get":{"summary":"List refunds","tags":["Refunds"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all refunds for an order.\n\n**Required scope:** `read_refunds` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment, refund_reason). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,reason,transaction_id). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"refunds found","content":{"application/json":{}}}}},"post":{"summary":"Create a refund","tags":["Refunds"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a refund for a payment on the order. The refund is automatically processed via the payment gateway.\n\n**Required scope:** `write_refunds` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"refund created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["payment_id","amount"],"properties":{"payment_id":{"type":"string","description":"Payment ID"},"amount":{"type":"string"},"refund_reason_id":{"type":"string","description":"Refund reason ID"}}}}}}}},"/api/v3/admin/locales":{"get":{"summary":"List supported locales","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the locales a merchant can translate content into for the current store, with the default and right-to-left flags.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"locales found","content":{"application/json":{}}}}}},"/api/v3/admin/store_credit_categories":{"get":{"summary":"List store credit categories","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the configured store credit categories. Categories classify\nstore credits (e.g., \"Goodwill\", \"Gift Card\", \"Refund\") and surface\nin the admin UI as a dropdown when issuing or editing a store\ncredit. Category names matching `Spree::Config[:non_expiring_credit_types]`\nare flagged via `non_expiring: true`.\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credit categories found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StoreCreditCategory"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/store_credit_categories/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Store credit category ID","schema":{"type":"string"}}],"get":{"summary":"Get a store credit category","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single store credit category by prefixed ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credit category found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoreCreditCategory"}}}},"404":{"description":"store credit category not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/store":{"get":{"summary":"Get the current store","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the current store configuration. The store is resolved from the request context (host or admin selection); there is no `id` parameter.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"current store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Store"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update the current store","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates the current store configuration.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"store updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Store"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"preferred_admin_locale":{"type":"string"},"preferred_timezone":{"type":"string"},"preferred_weight_unit":{"type":"string"},"preferred_unit_system":{"type":"string"}}}}}}}},"/api/v3/admin/tags":{"get":{"summary":"List tags","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns tag names for a given taggable type. Used for autocomplete in tag inputs on products, orders, and customers.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"taggable_type","in":"query","required":true,"description":"Taggable type (`Spree::Product`, `Spree::Order`, or `Spree::User`)","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Optional case-insensitive substring filter","schema":{"type":"string"}}],"responses":{"200":{"description":"tags found","content":{"application/json":{}}},"422":{"description":"invalid taggable type","content":{"application/json":{}}}}}},"/api/v3/admin/tax_rates":{"get":{"summary":"List tax rates","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's tax rates. Rates are the entire configuration of\nthe built-in tax provider: each pairs a tax category with a jurisdiction\n(a country, optionally narrowed to one state) and a percentage, and\ndecides whether the tax is already included in the product price\n(VAT-style) or added on top (US-style).\n\nMarkets using an external tax provider ignore these rows — that\nprovider carries its own jurisdiction data.\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[included_in_price_true]","in":"query","required":false,"description":"Only rates included in the product price","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rates found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TaxRate"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a tax rate for the current store. Give either `amount` as a\ndecimal (`0.19`) or `amount_percentage` as a percentage (`19`).\n\nName the jurisdiction with `country_iso` (and `state_code` for a\nstate-level rate). Omitting the country makes the rate apply everywhere.\n\nSet `included_in_price` for VAT-style pricing, where the rate is backed\nout of the displayed price rather than added to it.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"tax rate created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}},"422":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Customer-facing rate name, e.g. \"VAT\""},"amount":{"type":"string","description":"Rate as a decimal, e.g. \"0.19\""},"amount_percentage":{"type":"number","description":"Rate as a percentage, e.g. 19"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"tax_category_id":{"type":"string"},"country_iso":{"type":"string","description":"ISO code, e.g. \"DE\". Omit for every country."},"state_code":{"type":"string","description":"State abbreviation within that country, e.g. \"CA\"."}},"required":["name","tax_category_id"]}}},"required":true}}},"/api/v3/admin/tax_rates/{id}":{"parameters":[{"name":"id","in":"path","description":"Tax rate ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rate found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}}}},"patch":{"summary":"Update a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rate updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"amount":{"type":"string"},"amount_percentage":{"type":"number"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"tax_category_id":{"type":"string"},"country_iso":{"type":"string"},"state_code":{"type":"string"}}}}},"required":true}},"delete":{"summary":"Delete a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the rate. Tax lines it already produced keep their own rate snapshot.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"tax rate deleted"}}}},"/api/v3/admin/translatable_resources":{"get":{"summary":"List translatable resources","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns every translatable resource type and its translatable fields (key + content type), so clients can render translation editors generically.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translatable resources found","content":{"application/json":{}}}}}},"/api/v3/admin/translations/batch":{"post":{"summary":"Batch upsert translations","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Atomically upserts translations across many records of (possibly) different translatable resource types in one request — e.g. an option type and all its option values in one save. A flat list of independent registry writes; all entries succeed or none do.\n\n**Required scope:** `write_<resource>` for every resource type in the batch (for API-key authentication) (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translations upserted","content":{"application/json":{}}},"422":{"description":"unsupported locale rolls back the whole batch","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["translations"],"properties":{"translations":{"type":"array","items":{"type":"object","required":["resource_type","resource_id","values"],"properties":{"resource_type":{"type":"string","description":"Translatable resource type token, e.g. `option_type`"},"resource_id":{"type":"string","description":"Prefixed id of the record"},"values":{"type":"object","description":"Map of locale code to { field: value }","additionalProperties":{"type":"object","additionalProperties":true}}}}}}}}}}}},"/api/v3/admin/admin_users":{"get":{"summary":"List staff","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns admin users with at least one role assignment on the current store.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff found","content":{"application/json":{}}}}}},"/api/v3/admin/admin_users/{id}":{"get":{"summary":"Show a staff member","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff member found","content":{"application/json":{}}}}},"patch":{"summary":"Update a staff member","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name fields and reassigns roles for the current store. `role_ids` is a complete replacement — roles not in the array are removed for this store.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff member updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"role_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Remove a staff member from this store","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the user's role assignments on the current store. The account is preserved — the user keeps access to any other stores.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"staff removed from store"}}}},"/api/v3/admin/invitations":{"get":{"summary":"List invitations","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns invitations for the current store, including pending and accepted.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"invitations found","content":{"application/json":{}}}}},"post":{"summary":"Create an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Invites a teammate by email. The invitation is scoped to the current store and carries the chosen role; on accept, a `RoleUser` is created via the invitation's `after_accept` callback.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"invitation created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email","role_id"],"properties":{"email":{"type":"string"},"role_id":{"type":"string"}}}}}}}},"/api/v3/admin/invitations/{id}":{"delete":{"summary":"Revoke an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"invitation revoked"}}}},"/api/v3/admin/invitations/{id}/resend":{"patch":{"summary":"Resend an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a fresh token and dispatches the invitation email again.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"invitation resent","content":{"application/json":{}}}}}},"/api/v3/admin/permissions":{"get":{"summary":"List the permission catalog","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the permission catalog — the grant vocabulary shared by staff role permissions and secret API key scopes. Entries are grouped for permission pickers; labels and descriptions are localized. Readable by any authenticated admin credential.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"catalog returned","content":{"application/json":{}}}}}},"/api/v3/admin/roles":{"get":{"summary":"List roles","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns staff roles with their catalog permissions. Roles are global, not per-store; `mutable: false` marks the protected admin role and host-locked rows.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"roles found","content":{"application/json":{}}}}},"post":{"summary":"Create a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a staff role. `permissions` holds catalog keys (see GET /admin/permissions); a caller may only grant keys they effectively hold.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"role created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"permissions":{"type":"array","items":{"type":"string"}}},"required":["name"]}}}}}},"/api/v3/admin/roles/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a role name, description or permissions. The admin role and host-locked roles (`mutable: false`) reject changes.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"role updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"permissions":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a role. Fails with 422 while the role is protected or still referenced by staff members or pending invitations.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"role deleted"},"422":{"description":"role cannot be deleted","content":{"application/json":{}}}}}},"/api/v3/admin/stock_locations":{"get":{"summary":"List stock locations","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the configured stock locations. Stock locations are global\n(shared across stores). Filter with Ransack predicates such as\n`q[active_eq]`, `q[kind_eq]`, `q[pickup_enabled_eq]`, or\n`q[name_cont]`.\n\nPickup-related attributes (`kind`, `pickup_enabled`,\n`pickup_stock_policy`, `pickup_ready_in_minutes`,\n`pickup_instructions`) drive merchant pickup support at checkout —\ncustomers can collect orders from any active location with\n`pickup_enabled: true`.\n\n\n**Required scope:** `read_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[active_eq]","in":"query","required":false,"description":"Filter by active status","schema":{"type":"boolean"}},{"name":"q[kind_eq]","in":"query","required":false,"description":"Filter by kind (built-in: 'warehouse', 'store', 'fulfillment_center')","schema":{"type":"string"}},{"name":"q[pickup_enabled_eq]","in":"query","required":false,"description":"Filter by pickup-enabled flag","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"stock locations found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StockLocation"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new stock location.\n\nSetting `default: true` automatically demotes the previous default\nlocation.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"stock location created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true,"description":"Internal name shown only in the admin"},"active":{"type":"boolean"},"default":{"type":"boolean","description":"Setting to true demotes the previous default."},"kind":{"type":"string","enum":["warehouse","store","fulfillment_center"],"description":"Categorizes the location."},"propagate_all_variants":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_iso":{"type":"string","nullable":true,"description":"ISO-3166 alpha-2 country code (e.g. \"US\")."},"state_code":{"type":"string","nullable":true,"description":"State / province abbreviation (e.g. \"NY\"). Resolved against the selected country."},"state_name":{"type":"string","nullable":true,"description":"Free-text state for countries without a states list."},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string","enum":["local","any"],"description":"'local' = items at this location only; 'any' = transfer-eligible (ship-to-store)."},"pickup_ready_in_minutes":{"type":"number","nullable":true,"minimum":0},"pickup_instructions":{"type":"string","nullable":true}},"required":["name"]}}}}}},"/api/v3/admin/stock_locations/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Stock location ID","schema":{"type":"string"}}],"get":{"summary":"Get a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single stock location by prefixed ID.\n\n**Required scope:** `read_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"stock location found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"404":{"description":"stock location not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing stock location. Same address-field conventions as\nthe create endpoint.\n\nSetting `default: true` automatically demotes the previous default.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"stock location updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true},"active":{"type":"boolean"},"default":{"type":"boolean"},"kind":{"type":"string","enum":["warehouse","store","fulfillment_center"]},"propagate_all_variants":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_iso":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string","enum":["local","any"]},"pickup_ready_in_minutes":{"type":"number","nullable":true,"minimum":0},"pickup_instructions":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the stock location (sets `deleted_at`). Existing\nfulfillments that referenced it keep the historical record via\n`Spree::StockLocation.with_deleted`.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"stock location deleted"}}}},"/api/v3/admin/products/{product_id}/variants":{"get":{"summary":"List product variants","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of variants for a product, including the default variant.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., images, prices, stock_items, option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., sku,price,stock). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"variants found","content":{"application/json":{}}}}},"post":{"summary":"Create a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new variant for a product. Supports nested prices and stock items.\n\nOption types and values are auto-created if they don't exist.\nPrices are upserted by currency. Stock items are upserted by stock location.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"201":{"description":"variant created","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string"},"cost_price":{"type":"string"},"cost_currency":{"type":"string"},"weight":{"type":"number"},"height":{"type":"number"},"width":{"type":"number"},"depth":{"type":"number"},"weight_unit":{"type":"string"},"dimensions_unit":{"type":"string"},"track_inventory":{"type":"boolean"},"tax_category_id":{"type":"string"},"options":{"type":"array","description":"A variant on a product with option types should declare its option pairs (e.g. size + color) — one per option type it participates in. Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"position":{"type":"integer"},"barcode":{"type":"string"},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}}},"/api/v3/admin/products/{product_id}/variants/{id}":{"get":{"summary":"Get a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single variant by ID.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., images, prices, stock_items, option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., sku,price,stock). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"variant found","content":{"application/json":{}}},"404":{"description":"variant not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a variant. Only provided fields are updated.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}}],"responses":{"200":{"description":"variant updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string"},"cost_price":{"type":"string"},"cost_currency":{"type":"string"},"weight":{"type":"number"},"height":{"type":"number"},"width":{"type":"number"},"depth":{"type":"number"},"weight_unit":{"type":"string"},"dimensions_unit":{"type":"string"},"track_inventory":{"type":"boolean"},"tax_category_id":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"position":{"type":"integer"},"barcode":{"type":"string"},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}},"delete":{"summary":"Delete a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes a variant.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}}],"responses":{"204":{"description":"variant deleted"}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}}],"get":{"summary":"List webhook deliveries","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns delivery attempts for the given endpoint, most recent first.\nEach row carries the original request payload, the response code\n(when the receiver replied), the execution time, and any transport\nerror — everything needed to audit failures and decide whether to\nredeliver.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[event_name_eq]","in":"query","required":false,"description":"Filter by event name (exact)","schema":{"type":"string"}},{"name":"q[success_eq]","in":"query","required":false,"description":"Filter by success flag","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-delivered_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"deliveries found","content":{"application/json":{}}},"404":{"description":"parent webhook endpoint not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries/{id}":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Webhook delivery ID","schema":{"type":"string"}}],"get":{"summary":"Get a webhook delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single delivery attempt with the full request payload and\nthe response body the receiver returned. Use this for ad-hoc debug\nof failed deliveries.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"delivery found","content":{"application/json":{}}},"404":{"description":"delivery not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries/{id}/redeliver":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Webhook delivery ID to redeliver","schema":{"type":"string"}}],"post":{"summary":"Redeliver a webhook delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new delivery row with the same payload + event_name and\nqueues it. The original row is preserved for audit history.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"redelivery queued","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints":{"get":{"summary":"List webhook endpoints","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns outbound webhook subscriptions for the current store. Each\nendpoint receives a signed POST when any subscribed event fires.\n`secret_key` is `null` on list reads — the plaintext is delivered\nexactly once on create.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[url_cont]","in":"query","required":false,"description":"Filter by URL (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoints found","content":{"application/json":{}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new outbound webhook subscription. The plaintext\n`secret_key` is returned **once** in this response — persist it\nimmediately to verify incoming webhook signatures. Subsequent reads\nreturn `null` for the secret. Pass an empty `subscriptions` array or\nomit it to receive every event.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"webhook endpoint created — secret_key returned once","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"name":{"type":"string"},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/webhook_endpoints/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"get":{"summary":"Get a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single webhook endpoint by prefixed ID.\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint found","content":{"application/json":{}}},"404":{"description":"webhook endpoint not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name, URL, active flag, or the event subscription list.\nToggling `active` here is equivalent to calling `disable`/`enable`\nwithout an audit reason.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint updated","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the endpoint and stops future deliveries.\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"webhook endpoint deleted"}}}},"/api/v3/admin/webhook_endpoints/{id}/send_test":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"post":{"summary":"Send a test delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a `webhook.test` delivery record and queues it. Use this to\nverify the endpoint is reachable and your signature verification\naccepts Spree's payloads.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"test delivery queued","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints/{id}/enable":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"patch":{"summary":"Re-enable a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Re-enables an endpoint that was manually or automatically disabled.\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint enabled","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints/{id}/disable":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"patch":{"summary":"Disable a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Manually pauses an endpoint. Unlike auto-disable (triggered after\nrepeated delivery failures), no notification email is sent.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint disabled","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}}}},"/api/v3/admin/collections":{"get":{"summary":"List collections","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of the store's collections.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., rules, custom_fields, translations).","schema":{"type":"string"}}],"responses":{"200":{"description":"collections found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a manual or automatic (rule-based) collection. For automatic collections, send the full desired rule set under `rules`.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"collection created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string","enum":["all","any"]},"sort_order":{"type":"string"},"permalink":{"type":"string"},"description":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"},"rules":{"type":"array","description":"Full desired rule set. Entries with an id update, id-less entries create, omitted rules are removed.","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string"},"match_policy":{"type":"string"}}}}},"required":["name"]}}}}}},"/api/v3/admin/collections/{id}":{"get":{"summary":"Get a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single collection by ID, including its rules.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., rules, custom_fields, translations).","schema":{"type":"string"}}],"responses":{"200":{"description":"collection found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"404":{"description":"collection not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a collection. Send `position` to reorder it within the flat list; send the full `rules` set to sync automatic rules.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"200":{"description":"collection updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"permalink":{"type":"string"},"description":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"},"sort_order":{"type":"string"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer","description":"Reorders the collection within the flat list (acts_as_list)"},"rules":{"type":"array","description":"Full desired rule set (see create).","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string"},"match_policy":{"type":"string"}}}}}}}}}},"delete":{"summary":"Delete a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a collection.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"204":{"description":"collection deleted"}}}},"/api/v3/admin/collections/{collection_id}/products":{"get":{"summary":"List collection products","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Products curated in the collection, ordered by their membership position.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Add a product to a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Curates a product into the collection (appended to the end).\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"201":{"description":"product added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"string"}},"required":["product_id"]}}}}}},"/api/v3/admin/collections/{collection_id}/products/{id}":{"delete":{"summary":"Remove a product from a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes a product from the collection's manual curation.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product removed"}}}},"/api/v3/admin/collections/{collection_id}/products/{id}/reposition":{"patch":{"summary":"Reposition a collection product","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a product to a new index among the collection's products.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product repositioned"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_position":{"type":"integer","description":"0-based index among the collection's products"}},"required":["new_position"]}}}}}},"/api/v3/admin/collection_rules/types":{"get":{"summary":"List available collection rule types","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Enumerates the registered rule kinds with their labels and descriptions — drives the rule picker on an automatic collection. Plugins extend the list by registering `Spree::CollectionRule` subclasses via `config.spree.collection_rules`. The `type` returned here is the wire shorthand accepted when writing a collection's `rules`.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"types found","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/locations":{"get":{"summary":"List company locations","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the branches of a business customer. Each branch owns its own addresses and the buyers authorised to purchase for it.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"locations found","content":{"application/json":{}}}}},"post":{"summary":"Create a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a branch. Addresses are supplied inline and belong to the branch, so editing one later changes the branch's own record rather than an address the buyer also uses.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"location created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"billing_address":{"type":"object","description":"Created inline and owned by the branch.","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_iso":{"type":"string"}}}},"required":["name"]}}}}}},"/api/v3/admin/company_locations/{id}":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Branches are addressed by their own id once you hold one — the company id is not needed.\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"location found","content":{"application/json":{}}}}},"patch":{"summary":"Update a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Address fields sent here edit the branch's existing address in place; send only what changes.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"200":{"description":"location updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"billing_address":{"type":"object","properties":{"city":{"type":"string"}}}}}}}}},"delete":{"summary":"Delete a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the branch, its buyers and the addresses it owned.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"204":{"description":"location deleted"}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List tax exemption certificates","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a business's exemption evidence. `active` is the field that decides whether a certificate\nexempts a sale: a verified certificate stops counting once its expiry date passes, so the status\nalone does not answer it.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"certificates found","content":{"application/json":{}}}}},"post":{"summary":"Create a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Records exemption evidence against a business. Certificates start `pending` and exempt nothing\nuntil verified.\n\n`country_iso` and `state_code` say where the certificate holds — omit both for one valid\neverywhere, give only the country for one valid throughout it. `document` takes an ActiveStorage\nsigned blob id obtained from `POST /api/v3/admin/direct_uploads`.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"certificate created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"certificate_number":{"type":"string"},"reason_code":{"type":"string","description":"Becomes the tax provider's entity use code."},"country_iso":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"issuing_authority":{"type":"string","nullable":true},"document":{"type":"string","description":"ActiveStorage signed blob id from POST /api/v3/admin/direct_uploads."}},"required":["certificate_number","reason_code"]}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/verify":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Verify a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Accepts the certificate as evidence, which is what makes it exempt sales. Only a pending\ncertificate can be accepted — re-accepting a revoked one would restore evidence that was\ndeliberately withdrawn. An installation that checks numbers against a registry, or requires a\nsecond approval, can refuse here, and the refusal is returned as a validation error.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"200":{"description":"certificate verified","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/revoke":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Revoke a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Withdraws accepted evidence. A verified certificate cannot be deleted — how a sale was taxed has to remain explainable — so revoking is the way out.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"200":{"description":"certificate revoked","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/download":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Download a certificate document","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the uploaded document. Deliberately not a storage link: the bytes come through the API so\nthe same credentials apply to every read of a confidential document. Requires only read access.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"document streamed","content":{"application/json":{}}},"422":{"description":"no document attached","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_identifiers":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List company tax registrations","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the business's tax registrations, one per kind. A business registration takes precedence\nover the buyer's own when a sale is for that business, because the invoice is addressed to the\nentity rather than the person who placed the order.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"registrations found","content":{"application/json":{}}}}},"post":{"summary":"Create a company tax registration","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Registers a tax number against the business. Verification against the relevant registry runs in\nthe background where a validator is installed for the kind; a stock installation registers none,\nleaving the status unattempted.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"registration created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","description":"The regime the number belongs to."},"value":{"type":"string"}},"required":["kind","value"]}}}}}},"/api/v3/admin/companies/{company_id}/tax_identifiers/{id}/validate":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Re-check a company tax registration","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Asks the registry again. Manual because a registry answers only \"valid now\" — a number verified\nlast year may have been deregistered since — and because a check that came back unavailable\ncannot otherwise be retried without editing the number.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"422":{"description":"no validator installed for this kind","content":{"application/json":{}}}}}},"/api/v3/admin/companies":{"get":{"summary":"List companies","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the business customers of the current store.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"companies found","content":{"application/json":{}}}}},"post":{"summary":"Create a company","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a business customer. Exemption certificates and tax registrations hang off it.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"company created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"external_id":{"type":"string","nullable":true,"description":"Your own reference for this business, unique within the store."}},"required":["name"]}}}}}},"/api/v3/admin/company_locations/{company_location_id}/contacts":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_location_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List company contacts","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customers authorised to purchase for a branch. A customer may act for more than one branch.\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"contacts found","content":{"application/json":{}}}}},"post":{"summary":"Create a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Authorises a customer to purchase for a branch. A customer who acts for exactly one branch has\ntheir orders attributed to it automatically; one who acts for several needs the branch set on\nthe order, because guessing would invoice the wrong business.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"contact created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{"type":"string"},"role":{"type":"string","description":"Free-form label; carries no permissions in 6.0."}},"required":["customer_id"]}}}}}},"/api/v3/admin/company_contacts/{id}":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"contact found","content":{"application/json":{}}}}},"delete":{"summary":"Delete a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Withdraws the customer's authority to purchase for the branch. The customer account itself is untouched.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"204":{"description":"contact deleted"}}}},"/api/v3/admin/delivery_profiles":{"get":{"summary":"List delivery profiles","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Fulfillment profiles group products with the stock locations, delivery zones and delivery methods that fulfill them. Every store has exactly one default profile.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery profiles found","content":{"application/json":{}}}}},"post":{"summary":"Create a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery profile. `kind` selects the registered profile kind (shipping, digital, extension kinds); `stock_location_ids` limits fulfillment to those locations — empty means every store location.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"delivery profile created","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"kind":{"type":"string","description":"Registered profile kind; defaults to shipping."},"default":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"},"description":"Empty means every store location."}},"required":["name"]}}}}}},"/api/v3/admin/delivery_profiles/{delivery_profile_id}/origin_groups":{"parameters":[{"name":"delivery_profile_id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Create an origin group","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Origin groups partition a profile's fulfillment origins: zones and methods belong to a group, so the same products can quote different rate tables per warehouse. `stock_location_ids` replaces the full membership; empty means every store location.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"origin group created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","nullable":true},"position":{"type":"integer","nullable":true},"stock_location_ids":{"type":"array","items":{"type":"string"},"description":"Empty means every store location."}}}}}}}},"/api/v3/admin/delivery_profiles/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery profile updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"default":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"The default profile and profiles still referenced by products cannot be deleted.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"delivery profile deleted"}}}},"/api/v3/admin/delivery_methods":{"get":{"summary":"List delivery methods","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all delivery methods with calculator and zone configuration.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery methods found","content":{"application/json":{}}}}},"post":{"summary":"Create delivery method","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery method inside a delivery profile (defaults to the store default profile). Delivery behavior comes from the fulfillment provider.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"delivery method created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"fulfillment_provider":{"type":"string","nullable":true},"delivery_profile_id":{"type":"string","nullable":true},"storefront_visible":{"type":"boolean"},"tracking_url":{"type":"string","nullable":true},"estimated_transit_business_days_min":{"type":"integer","nullable":true},"estimated_transit_business_days_max":{"type":"integer","nullable":true},"tax_category_id":{"type":"string","nullable":true},"calculator_type":{"type":"string"},"calculator_preferences":{"type":"object"},"delivery_zone_id":{"type":"string","nullable":true}},"required":["name"]}}}}}},"/api/v3/admin/delivery_methods/calculators":{"get":{"summary":"List delivery calculators","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Registered delivery calculator classes with preference schemas for building configuration forms.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"calculators found","content":{"application/json":{}}}}}},"/api/v3/admin/delivery_zones":{"post":{"summary":"Create delivery zone","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery zone with typed members: country, state, or postal_code (prefix or from/to range).\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed, e.g. `members`","schema":{"type":"string"}}],"responses":{"201":{"description":"delivery zone created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"members":{"type":"array","items":{"type":"object","properties":{"member_type":{"type":"string","enum":["country","state","postal_code"]},"country_iso":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"postal_code_prefix":{"type":"string","nullable":true},"postal_code_from":{"type":"string","nullable":true},"postal_code_to":{"type":"string","nullable":true}},"required":["member_type"]}}},"required":["name"]}}}}}},"/api/v3/admin/integrations":{"get":{"summary":"List integrations","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the integrations connected to the current store. Secret preference values are masked.\n\n**Required scope:** `read_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"integrations found","content":{"application/json":{}}}}},"post":{"summary":"Connect integration","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Connects an integration type to the current store. Setting active: true verifies the connection and fails with 422 when it cannot connect. Submitting a masked secret value back keeps the stored secret.\n\n**Required scope:** `write_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"integration connected","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Wire shorthand from GET /integrations/types"},"active":{"type":"boolean"},"preferences":{"type":"object"}},"required":["type"]}}}}}},"/api/v3/admin/integrations/types":{"get":{"summary":"List integration types","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Every registered integration type with its gallery metadata and configuration schema. Pure registry discovery — read live connection state from GET /integrations.\n\n**Required scope:** `read_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"integration types found","content":{"application/json":{}}}}}},"/api/v3/admin/integrations/{id}/test":{"post":{"summary":"Test integration connection","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Runs a live connection check against the provider. Nothing is persisted; a failed check reports the vendor error message.\n\n**Required scope:** `write_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"connection checked","content":{"application/json":{}}}}}},"/api/v3/admin/product_types":{"get":{"summary":"List product types","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of product types.\n\nA product type is a back-office template: it seeds option types and\ncategories onto products created with it, and defines which custom\nfields those products' forms show. It is not exposed on the Store API.\n\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}}],"responses":{"200":{"description":"product types found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ProductType"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a product type.\n\n`option_type_ids` and `category_ids` seed products created with this\ntype. `custom_field_definitions` is a replace-set of the definitions the\nproduct form renders, in `sort_order`. `required` is advisory — the\ndashboard marks the field, but a blank value is never rejected.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"product type created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}},"422":{"description":"unprocessable entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true,"description":"Fulfillment profile stamped onto products created with this type. Null leaves new products on the store default profile."},"option_type_ids":{"type":"array","items":{"type":"string"},"description":"Option types seeded onto products created with this type."},"category_ids":{"type":"array","items":{"type":"string"},"description":"Categories seeded onto products created with this type."},"custom_field_definitions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Prefixed custom field definition id."},"required":{"type":"boolean"},"sort_order":{"type":"integer"}}}}},"required":["name"]}}}}}},"/api/v3/admin/product_types/{id}":{"parameters":[{"name":"id","in":"path","description":"Product type ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Retrieve a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single product type with its option types, categories and custom fields.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"product type found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}},"404":{"description":"product type not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a product type.\n\nChanges never modify products that already carry the type — use\n`apply_to_products` to backfill those.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"product type updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"option_type_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"custom_field_definitions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"required":{"type":"boolean"},"sort_order":{"type":"integer"}}}}}}}}}},"delete":{"summary":"Delete a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a product type. Types still used by products cannot be deleted.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"product type deleted"}}}},"/api/v3/admin/product_types/{id}/apply_to_products":{"parameters":[{"name":"id","in":"path","description":"Product type ID","required":true,"schema":{"type":"string"}}],"post":{"summary":"Apply a product type to its existing products","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Backfills the type's option types and categories onto the products that\nalready carry it. Additive and idempotent — nothing is removed, and\nre-running is safe.\n\nRuns in the background; the response reports how many products the type\ncurrently has.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"202":{"description":"backfill accepted","content":{"application/json":{"schema":{"type":"object","properties":{"products_count":{"type":"integer"}}}}}}}}}},"components":{"schemas":{"PaginationMeta":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"count":{"type":"integer","description":"Total number of records"},"pages":{"type":"integer","description":"Total number of pages"},"from":{"type":"integer","description":"Index of first record on this page"},"to":{"type":"integer","description":"Index of last record on this page"},"in":{"type":"integer","description":"Number of records on this page"},"previous":{"type":"integer","nullable":true,"description":"Previous page number"},"next":{"type":"integer","nullable":true,"description":"Next page number"}},"required":["page","limit","count","pages","from","to","in"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","description":"Field-specific validation errors","nullable":true}},"required":["code","message"]}},"required":["error"]},"AuthResponse":{"type":"object","properties":{"token":{"type":"string","description":"JWT access token"},"user":{"$ref":"#/components/schemas/AdminUser"}},"required":["token","user"]},"PermissionRule":{"type":"object","description":"A single permission rule (CanCanCan rule). Rules are applied in order, last-matching-wins.","properties":{"allow":{"type":"boolean","description":"true for `can`, false for `cannot`"},"actions":{"type":"array","items":{"type":"string"},"description":"Action names, e.g. [\"read\", \"update\"] or [\"manage\"]"},"subjects":{"type":"array","items":{"type":"string"},"description":"Subject class names, e.g. [\"Spree::Product\"] or [\"all\"]"},"has_conditions":{"type":"boolean","description":"True if the server-side rule has per-record conditions. The SPA shows the action optimistically and handles 403 from the API."}},"required":["allow","actions","subjects","has_conditions"]},"MeResponse":{"type":"object","description":"Current admin user profile and serialized permissions","properties":{"user":{"$ref":"#/components/schemas/AdminUser"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/PermissionRule"}}},"required":["user","permissions"]},"ImportSchemaField":{"type":"object","description":"A canonical column of an import type, including per-store custom field columns","properties":{"name":{"type":"string","description":"Canonical field name used in mappings"},"label":{"type":"string","description":"Human-readable label"},"required":{"type":"boolean","description":"Whether the field must be mapped before processing"}},"required":["name","label","required"]},"CheckoutRequirement":{"type":"object","properties":{"step":{"type":"string","description":"Checkout step this requirement belongs to"},"field":{"type":"string","description":"Field that needs to be satisfied"},"message":{"type":"string","description":"Human-readable requirement message"}},"required":["step","field","message"]},"CartWarning":{"type":"object","description":"A warning about a cart issue (e.g., item removed due to stock change)","properties":{"code":{"type":"string","description":"Machine-readable warning code"},"message":{"type":"string","description":"Human-readable warning message"},"line_item_id":{"type":"string","nullable":true,"description":"Prefixed line item ID (when applicable)"},"variant_id":{"type":"string","nullable":true,"description":"Prefixed variant ID (when applicable)"},"item_index":{"type":"integer","nullable":true,"description":"Position in the submitted items array, for warnings raised while applying a batch of item changes"}},"required":["code","message"]},"FulfillmentManifestItem":{"type":"object","description":"An item within a fulfillment — which line item and how many units are in this fulfillment","properties":{"item_id":{"type":"string","description":"Line item ID"},"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer","description":"Quantity in this fulfillment"}},"required":["item_id","variant_id","quantity"]},"AdminUserRoleAssignment":{"type":"object","description":"A role assignment for the current store on a staff member","properties":{"id":{"type":"string","description":"Prefixed role ID"},"name":{"type":"string","description":"Role name"}},"required":["id","name"]},"AdminUserStore":{"type":"object","description":"A store the staff member can access through a role assignment","properties":{"id":{"type":"string","description":"Prefixed store ID"},"name":{"type":"string","description":"Store name"},"code":{"type":"string","description":"Store code"}},"required":["id","name","code"]},"PreferenceField":{"type":"object","description":"A single configurable preference on a payment method, promotion rule/action, or calculator. The frontend uses `type` + `default` to render a sensible input.","properties":{"key":{"type":"string"},"type":{"type":"string","description":"string | text | password | integer | decimal | boolean | array | hash"},"default":{"description":"Default value (any JSON type), null when there is no default","nullable":true}},"required":["key","type"]},"PromotionActionCalculator":{"type":"object","description":"The action's nested calculator (when the action carries one — null for actions like `free_shipping`)","properties":{"type":{"type":"string","description":"Wire shorthand for the calculator subclass"},"label":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}}},"required":["type","label","preferences","preference_schema"]},"PromotionActionLineItem":{"type":"object","description":"One row in a `create_line_items` action — the variant added to the order and how many","properties":{"variant_id":{"type":"string"},"quantity":{"type":"integer"}},"required":["variant_id","quantity"]},"Address":{"type":"object","properties":{"id":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"full_name":{"type":"string"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"postal_code":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_name":{"type":"string"},"country_iso":{"type":"string"},"state_text":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"quick_checkout":{"type":"boolean"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"},"state_abbr":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"label":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true}},"required":["id","first_name","last_name","full_name","address1","address2","postal_code","city","phone","company","country_name","country_iso","state_text","state_code","quick_checkout","is_default_billing","is_default_shipping","state_abbr","state_name","label","metadata","created_at","updated_at","customer_id"],"x-typelizer":true},"AdminUser":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"full_name":{"type":"string","nullable":true},"selected_locale":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"avatar_url":{"type":"string","nullable":true},"roles":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserRoleAssignment"}},"stores":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserStore"}}},"required":["id","email","first_name","last_name","full_name","selected_locale","created_at","updated_at","avatar_url","roles","stores"],"x-typelizer":true},"AllowedOrigin":{"type":"object","properties":{"id":{"type":"string"},"origin":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","origin","created_at","updated_at"],"x-typelizer":true},"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"key_type":{"type":"string"},"token_prefix":{"type":"string","nullable":true},"scopes":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"revoked_at":{"type":"string","nullable":true},"last_used_at":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"plaintext_token":{"type":"string","nullable":true},"created_by_email":{"type":"string","nullable":true}},"required":["id","name","key_type","token_prefix","scopes","created_at","updated_at","revoked_at","last_used_at","channel_id","plaintext_token","created_by_email"],"x-typelizer":true},"AppliedPromotion":{"type":"object","properties":{"id":{"type":"string"},"promotion_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","promotion_id","name","description","code","amount","display_amount","created_at","updated_at"],"x-typelizer":true},"Cart":{"type":"object","properties":{"id":{"type":"string"},"market_id":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"preferred_stock_location_id":{"type":"string","nullable":true},"number":{"type":"string"},"token":{"type":"string"},"email":{"type":"string","nullable":true},"customer_note":{"type":"string","nullable":true},"currency":{"type":"string"},"locale":{"type":"string","nullable":true},"total_quantity":{"type":"number"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/CartWarning"}},"coupon_code":{"type":"string","nullable":true},"item_total":{"type":"string","nullable":true},"display_item_total":{"type":"string","nullable":true},"adjustment_total":{"type":"string","nullable":true},"display_adjustment_total":{"type":"string","nullable":true},"discount_total":{"type":"string","nullable":true},"display_discount_total":{"type":"string","nullable":true},"tax_total":{"type":"string","nullable":true},"display_tax_total":{"type":"string","nullable":true},"included_tax_total":{"type":"string","nullable":true},"display_included_tax_total":{"type":"string","nullable":true},"additional_tax_total":{"type":"string","nullable":true},"display_additional_tax_total":{"type":"string","nullable":true},"total":{"type":"string","nullable":true},"display_total":{"type":"string","nullable":true},"gift_card_total":{"type":"string","nullable":true},"display_gift_card_total":{"type":"string","nullable":true},"amount_due":{"type":"string","nullable":true},"display_amount_due":{"type":"string","nullable":true},"delivery_total":{"type":"string","nullable":true},"display_delivery_total":{"type":"string","nullable":true},"store_credit_total":{"type":"string","nullable":true},"display_store_credit_total":{"type":"string","nullable":true},"covered_by_store_credit":{"type":"boolean"},"current_step":{"type":"string"},"completed_steps":{"type":"array","items":{"type":"string"}},"requirements":{"type":"array","items":{"$ref":"#/components/schemas/CheckoutRequirement"}},"shipping_eq_billing_address":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"}},"billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true},"completed_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"applied_promotions":{"type":"array","items":{"$ref":"#/components/schemas/AppliedPromotion"}}},"required":["id","market_id","channel_id","preferred_stock_location_id","number","token","email","customer_note","currency","locale","total_quantity","warnings","coupon_code","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","store_credit_total","display_store_credit_total","covered_by_store_credit","current_step","completed_steps","requirements","shipping_eq_billing_address","items","billing_address","shipping_address","market","completed_at","created_at","updated_at","applied_promotions"],"x-typelizer":true},"Category":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"permalink":{"type":"string"},"position":{"type":"number"},"depth":{"type":"number"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"children_count":{"type":"number"},"parent_id":{"type":"string","nullable":true},"description":{"type":"string"},"description_html":{"type":"string"},"image_url":{"type":"string","nullable":true},"square_image_url":{"type":"string","nullable":true},"is_root":{"type":"boolean"},"is_child":{"type":"boolean"},"is_leaf":{"type":"boolean"},"parent":{"$ref":"#/components/schemas/Category"},"children":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"ancestors":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"translations":{"type":"object"},"metadata":{"type":"object"},"pretty_name":{"type":"string"},"lft":{"type":"number"},"rgt":{"type":"number"},"products_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","permalink","position","depth","meta_title","meta_description","meta_keywords","children_count","parent_id","description","description_html","image_url","square_image_url","is_root","is_child","is_leaf","metadata","pretty_name","lft","rgt","products_count","created_at","updated_at"],"x-typelizer":true},"Channel":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string"},"active":{"type":"boolean"},"default":{"type":"boolean"},"storefront_access":{"type":"string"},"guest_checkout":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string","nullable":true},"preferred_storefront_access":{"type":"string","nullable":true},"preferred_guest_checkout":{"type":"boolean","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","code","active","default","storefront_access","guest_checkout","preferred_order_routing_strategy","preferred_storefront_access","preferred_guest_checkout","created_at","updated_at","stock_location_ids"],"x-typelizer":true},"ClaimLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"send_replacement":{"type":"boolean"},"description":{"type":"string","nullable":true},"refund_amount":{"type":"string"},"paid_amount":{"type":"string"},"display_refund_amount":{"type":"string"},"variant_id":{"type":"string","nullable":true},"replacement_variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"replacement_variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","quantity","send_replacement","description","refund_amount","paid_amount","display_refund_amount","variant_id","replacement_variant_id","line_item_id","created_at","updated_at"],"x-typelizer":true},"ClaimReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Claim":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"resolution":{"type":"string","nullable":true},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"refund_total":{"type":"string"},"display_refund_total":{"type":"string"},"approved_at":{"type":"string","nullable":true},"resolved_at":{"type":"string","nullable":true},"denied_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ClaimReason"},"claim_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ClaimLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"created_by_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","resolution","order_id","reason_id","refund_total","display_refund_total","approved_at","resolved_at","denied_at","canceled_at","memo","metadata","created_at","updated_at","created_by_id"],"x-typelizer":true},"CollectionRule":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string","nullable":true},"match_policy":{"type":"string"}},"required":["id","type","value","match_policy"],"x-typelizer":true},"Collection":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"permalink":{"type":"string"},"position":{"type":"number"},"sort_order":{"type":"string"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"products_count":{"type":"number"},"description":{"type":"string"},"description_html":{"type":"string"},"image_url":{"type":"string","nullable":true},"square_image_url":{"type":"string","nullable":true},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"translations":{"type":"object"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string"},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"rules":{"type":"array","items":{"$ref":"#/components/schemas/CollectionRule"}}},"required":["id","name","permalink","position","sort_order","meta_title","meta_description","meta_keywords","products_count","description","description_html","image_url","square_image_url","automatic","rules_match_policy","metadata","created_at","updated_at"],"x-typelizer":true},"CompanyContact":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_location_id":{"type":"string"},"customer_id":{"type":"string"},"email":{"type":"string","nullable":true}},"required":["id","role","created_at","updated_at","company_location_id","customer_id","email"],"x-typelizer":true},"CompanyLocation":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_id":{"type":"string"},"contacts_count":{"type":"number"},"billing_address":{"$ref":"#/components/schemas/Address"},"shipping_address":{"$ref":"#/components/schemas/Address"},"company_contacts":{"type":"array","items":{"$ref":"#/components/schemas/CompanyContact"}}},"required":["id","name","external_id","metadata","created_at","updated_at","company_id","contacts_count","billing_address","shipping_address"],"x-typelizer":true},"Company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"locations_count":{"type":"number"},"company_locations":{"type":"array","items":{"$ref":"#/components/schemas/CompanyLocation"}}},"required":["id","name","external_id","metadata","created_at","updated_at","locations_count"],"x-typelizer":true},"Country":{"type":"object","properties":{"iso":{"type":"string"},"iso3":{"type":"string"},"name":{"type":"string"},"states_required":{"type":"boolean"},"zipcode_required":{"type":"boolean"},"states":{"type":"array","items":{"$ref":"#/components/schemas/State"}},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true}},"required":["iso","iso3","name","states_required","zipcode_required"],"x-typelizer":true},"CouponCode":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"state":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"promotion_id":{"type":"string"},"order_id":{"type":"string","nullable":true}},"required":["id","code","state","created_at","updated_at","promotion_id","order_id"],"x-typelizer":true},"CreditCard":{"type":"object","properties":{"id":{"type":"string"},"brand":{"type":"string"},"last4":{"type":"string"},"month":{"type":"number"},"year":{"type":"number"},"name":{"type":"string","nullable":true},"default":{"type":"boolean"},"gateway_payment_profile_id":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true},"payment_method_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","brand","last4","month","year","name","default","gateway_payment_profile_id","customer_id","payment_method_id","metadata","created_at","updated_at"],"x-typelizer":true},"CustomFieldDefinition":{"type":"object","properties":{"id":{"type":"string"},"namespace":{"type":"string"},"key":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"resource_type":{"type":"string"},"storefront_visible":{"type":"boolean"},"searchable":{"type":"boolean"},"sortable":{"type":"boolean"},"filter_key":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","namespace","key","label","field_type","resource_type","storefront_visible","searchable","sortable","filter_key","created_at","updated_at"],"x-typelizer":true},"CustomField":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","deprecated":true},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"key":{"type":"string"},"value":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"storefront_visible":{"type":"boolean"},"custom_field_definition_id":{"type":"string"}},"required":["id","label","type","field_type","key","value","created_at","updated_at","storefront_visible","custom_field_definition_id"],"x-typelizer":true},"CustomerGroup":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"customers_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}},"required":["id","name","description","customers_count","created_at","updated_at"],"x-typelizer":true},"Customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"accepts_email_marketing":{"type":"boolean"},"full_name":{"type":"string"},"available_store_credit_total":{"type":"string"},"display_available_store_credit_total":{"type":"string"},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/Address"}},"default_billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"default_shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"newsletter_subscriber":{"allOf":[{"$ref":"#/components/schemas/NewsletterSubscriber"}],"nullable":true},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"failed_attempts":{"type":"number"},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"internal_note":{"type":"string","nullable":true},"internal_note_html":{"type":"string","nullable":true},"default_billing_address_id":{"type":"string","nullable":true},"default_shipping_address_id":{"type":"string","nullable":true},"orders_count":{"type":"number"},"total_spent":{"type":"string"},"display_total_spent":{"type":"string"},"last_order_completed_at":{"type":"string","nullable":true},"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"store_credits":{"type":"array","items":{"$ref":"#/components/schemas/StoreCredit"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}},"required":["id","email","first_name","last_name","phone","accepts_email_marketing","full_name","available_store_credit_total","display_available_store_credit_total","failed_attempts","metadata","created_at","updated_at","tags","internal_note","internal_note_html","default_billing_address_id","default_shipping_address_id","orders_count","total_spent","display_total_spent","last_order_completed_at","customer_group_ids"],"x-typelizer":true},"DeliveryMethodRule":{"type":"object","properties":{"id":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"},"product_ids":{"type":"array","items":{"type":"string"}}},"required":["id","active","created_at","updated_at","type","name","description","preferences","preference_schema","product_ids"],"x-typelizer":true},"DeliveryMethod":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string","nullable":true},"estimated_transit_business_days_min":{"type":"number","nullable":true},"estimated_transit_business_days_max":{"type":"number","nullable":true},"digital":{"type":"boolean"},"pickup":{"type":"boolean"},"pickup_point":{"type":"boolean"},"admin_name":{"type":"string","nullable":true},"fulfillment_provider":{"type":"string"},"pickup_point_provider":{"type":"string","nullable":true},"rate_provider":{"type":"string","nullable":true},"storefront_visible":{"type":"boolean"},"tracking_url":{"type":"string","nullable":true},"markup_flat":{"type":"string","nullable":true},"markup_percent":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string"},"services":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryMethodService"}},"rules":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryMethodRule"}},"tax_category_id":{"type":"string","nullable":true},"delivery_profile_id":{"type":"string"},"delivery_origin_group_id":{"type":"string","nullable":true},"delivery_zone_id":{"type":"string","nullable":true},"stock_location_ids":{"type":"array","items":{"type":"string"}},"calculator_type":{"type":"string","nullable":true},"calculator_preferences":{"type":"object","nullable":true}},"required":["id","name","code","estimated_transit_business_days_min","estimated_transit_business_days_max","digital","pickup","pickup_point","admin_name","fulfillment_provider","pickup_point_provider","rate_provider","storefront_visible","tracking_url","markup_flat","markup_percent","created_at","updated_at","deleted_at","services","rules","tax_category_id","delivery_profile_id","delivery_origin_group_id","delivery_zone_id","stock_location_ids","calculator_type","calculator_preferences"],"x-typelizer":true},"DeliveryMethodService":{"type":"object","properties":{"id":{"type":"string"},"carrier":{"type":"string"},"service":{"type":"string"},"label":{"type":"string","nullable":true},"markup_flat":{"type":"string","nullable":true},"markup_percent":{"type":"string","nullable":true},"position":{"type":"number"}},"required":["id","carrier","service","label","markup_flat","markup_percent","position"],"x-typelizer":true},"DeliveryOriginGroup":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true},"position":{"type":"number","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string"},"stock_location_ids":{"type":"array","items":{"type":"string"}},"delivery_zones_count":{"type":"number"},"delivery_methods_count":{"type":"number"}},"required":["id","name","position","created_at","updated_at","delivery_profile_id","stock_location_ids","delivery_zones_count","delivery_methods_count"],"x-typelizer":true},"DeliveryProfile":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"default":{"type":"boolean"},"position":{"type":"number","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"kind":{"type":"string"},"digital":{"type":"boolean"},"offers_pickup":{"type":"boolean"},"offers_shipping":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"}},"origin_groups":{"type":"object"},"products_count":{"type":"number"},"delivery_methods_count":{"type":"number"},"delivery_zones_count":{"type":"number"}},"required":["id","name","default","position","created_at","updated_at","kind","digital","offers_pickup","offers_shipping","stock_location_ids","origin_groups","products_count","delivery_methods_count","delivery_zones_count"],"x-typelizer":true},"DeliveryRate":{"type":"object","properties":{"id":{"type":"string"},"delivery_method_id":{"type":"string"},"name":{"type":"string"},"selected":{"type":"boolean"},"cost":{"type":"string"},"total":{"type":"string"},"additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"tax_total":{"type":"string"},"carrier":{"type":"string","nullable":true},"service_level":{"type":"string","nullable":true},"estimated_delivery_date":{"type":"string","nullable":true},"display_cost":{"type":"string"},"display_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"delivery_method":{"$ref":"#/components/schemas/DeliveryMethod"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","delivery_method_id","name","selected","cost","total","additional_tax_total","included_tax_total","tax_total","carrier","service_level","estimated_delivery_date","display_cost","display_total","display_additional_tax_total","display_included_tax_total","display_tax_total","metadata","created_at","updated_at"],"x-typelizer":true},"DeliveryZoneMember":{"type":"object","properties":{"id":{"type":"string"},"member_type":{"type":"string"},"country_iso":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"postal_code_prefix":{"type":"string","nullable":true},"postal_code_from":{"type":"string","nullable":true},"postal_code_to":{"type":"string","nullable":true},"country_name":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","member_type","country_iso","state_code","postal_code_prefix","postal_code_from","postal_code_to","country_name","state_name","created_at","updated_at"],"x-typelizer":true},"DeliveryZone":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"members":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryZoneMember"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string"},"delivery_origin_group_id":{"type":"string","nullable":true},"delivery_method_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","description","created_at","updated_at","delivery_profile_id","delivery_origin_group_id","delivery_method_ids"],"x-typelizer":true},"DigitalLink":{"type":"object","properties":{"id":{"type":"string"},"access_counter":{"type":"number"},"filename":{"type":"string"},"content_type":{"type":"string"},"download_url":{"type":"string"},"authorizable":{"type":"boolean"},"expired":{"type":"boolean"},"access_limit_exceeded":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","access_counter","filename","content_type","download_url","authorizable","expired","access_limit_exceeded","created_at","updated_at"],"x-typelizer":true},"Discount":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"code":{"type":"string","nullable":true},"value_type":{"type":"string","nullable":true},"value":{"type":"string","nullable":true},"promotion_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","kind","code","value_type","value","promotion_id","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":true},"ExchangeLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"received_quantity":{"type":"number"},"resellable":{"type":"boolean"},"original_price":{"type":"string"},"new_variant_price":{"type":"string"},"price_difference":{"type":"string"},"original_variant_id":{"type":"string","nullable":true},"new_variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_item_id":{"type":"string","nullable":true},"original_variant":{"$ref":"#/components/schemas/Variant"},"new_variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","quantity","received_quantity","resellable","original_price","new_variant_price","price_difference","original_variant_id","new_variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":true},"Exchange":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"price_difference":{"type":"string"},"display_price_difference":{"type":"string"},"approved_at":{"type":"string","nullable":true},"received_at":{"type":"string","nullable":true},"fulfilled_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ReturnReason"},"exchange_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ExchangeLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","order_id","reason_id","price_difference","display_price_difference","approved_at","received_at","fulfilled_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id"],"x-typelizer":true},"Export":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"format":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true},"done":{"type":"boolean"},"filename":{"type":"string","nullable":true},"byte_size":{"type":"number","nullable":true},"download_url":{"type":"string","nullable":true}},"required":["id","number","format","created_at","updated_at","type","user_id","done","filename","byte_size","download_url"],"x-typelizer":true},"Fee":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","kind","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":true},"FulfillmentItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"status":{"type":"string"},"variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"options_text":{"type":"string","nullable":true}},"required":["id","quantity","status","variant_id","line_item_id","name","options_text"],"x-typelizer":true},"Fulfillment":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"tracking":{"type":"string","nullable":true},"tracking_url":{"type":"string","nullable":true},"tracking_carrier":{"type":"string","nullable":true},"tracking_carrier_name":{"type":"string","nullable":true},"pickup_point_data":{"type":"object","nullable":true},"selected_delivery_rate_id":{"type":"string","nullable":true},"cost":{"type":"string"},"display_cost":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"status":{"type":"string"},"fulfillment_type":{"type":"string"},"fulfilled_at":{"type":"string","nullable":true},"tracking_status":{"type":"string","nullable":true},"estimated_delivery_at":{"type":"string","nullable":true},"delivered_at":{"type":"string","nullable":true},"items":{"type":"array","items":{"$ref":"#/components/schemas/FulfillmentManifestItem"}},"delivery_method":{"$ref":"#/components/schemas/DeliveryMethod"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"delivery_rates":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryRate"}},"tax_lines":{"type":"array","items":{"$ref":"#/components/schemas/TaxLine"}},"metadata":{"type":"object"},"tracking_details":{"type":"object","nullable":true},"adjustment_total":{"type":"string"},"pre_tax_amount":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"order_id":{"type":"string","nullable":true},"stock_location_id":{"type":"string","nullable":true},"documents":{"type":"object"},"provider_generates_labels":{"type":"boolean"},"fulfillment_items":{"type":"array","items":{"$ref":"#/components/schemas/FulfillmentItem"}},"order":{"$ref":"#/components/schemas/Order"}},"required":["id","number","tracking","tracking_url","tracking_carrier","tracking_carrier_name","pickup_point_data","selected_delivery_rate_id","cost","display_cost","total","display_total","discount_total","display_discount_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","tax_total","display_tax_total","status","fulfillment_type","fulfilled_at","tracking_status","estimated_delivery_at","delivered_at","items","metadata","tracking_details","adjustment_total","pre_tax_amount","created_at","updated_at","order_id","stock_location_id","documents","provider_generates_labels"],"x-typelizer":true},"GiftCardBatch":{"type":"object","properties":{"id":{"type":"string"},"codes_count":{"type":"number"},"currency":{"type":"string","nullable":true},"prefix":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"amount":{"type":"string","nullable":true},"expires_at":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true}},"required":["id","codes_count","currency","prefix","created_at","updated_at","amount","expires_at","created_by_id"],"x-typelizer":true},"GiftCard":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string"},"amount_used":{"type":"string"},"amount_authorized":{"type":"string"},"amount_remaining":{"type":"string"},"display_amount":{"type":"string"},"display_amount_used":{"type":"string"},"display_amount_remaining":{"type":"string"},"expires_at":{"type":"string","nullable":true},"redeemed_at":{"type":"string","nullable":true},"expired":{"type":"boolean"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"customer":{"$ref":"#/components/schemas/Customer"},"created_by":{"$ref":"#/components/schemas/AdminUser"},"gift_card_batch":{"$ref":"#/components/schemas/GiftCardBatch"},"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}}},"required":["id","code","status","currency","amount","amount_used","amount_authorized","amount_remaining","display_amount","display_amount_used","display_amount_remaining","expires_at","redeemed_at","expired","active","created_at","updated_at","customer_id","created_by_id"],"x-typelizer":true},"ImportMapping":{"type":"object","properties":{"id":{"type":"string"},"schema_field":{"type":"string"},"file_column":{"type":"string","nullable":true},"required":{"type":"boolean"}},"required":["id","schema_field","file_column","required"],"x-typelizer":true},"ImportRow":{"type":"object","properties":{"id":{"type":"string"},"row_number":{"type":"number"},"status":{"type":"string"},"validation_errors":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"import_id":{"type":"string","nullable":true},"item_type":{"type":"string","nullable":true},"item_id":{"type":"string","nullable":true},"data":{"type":"object"}},"required":["id","row_number","status","validation_errors","created_at","updated_at","import_id","item_type","item_id","data"],"x-typelizer":true},"Import":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"rows_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string","nullable":true},"status":{"type":"string"},"owner_type":{"type":"string","nullable":true},"owner_id":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true},"processing_errors":{"type":"string","nullable":true},"preferred_delimiter":{"type":"string"},"original_filename":{"type":"string","nullable":true},"original_byte_size":{"type":"number","nullable":true},"original_file_url":{"type":"string","nullable":true},"completed_rows_count":{"type":"number"},"failed_rows_count":{"type":"number"},"schema_fields":{"type":"array","items":{"$ref":"#/components/schemas/ImportSchemaField"}},"csv_headers":{"type":"array","items":{"type":"string"}},"sample_row":{"type":"object"},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/ImportMapping"}}},"required":["id","number","rows_count","created_at","updated_at","type","status","owner_type","owner_id","user_id","processing_errors","preferred_delimiter","original_filename","original_byte_size","original_file_url","completed_rows_count","failed_rows_count","schema_fields","csv_headers","sample_row","mappings"],"x-typelizer":true},"Integration":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"group":{"type":"string","nullable":true},"preferences":{"type":"object"},"preference_schema":{"type":"object"}},"required":["id","name","active","created_at","updated_at","type","group","preferences","preference_schema"],"x-typelizer":true},"Invitation":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"status":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"expires_at":{"type":"string"},"role_id":{"type":"string"},"role_name":{"type":"string"},"inviter_email":{"type":"string"},"acceptance_url":{"type":"string"},"invitee_exists":{"type":"boolean"},"store":{"type":"object"}},"required":["id","email","status","created_at","updated_at","expires_at","role_id","role_name","inviter_email","acceptance_url","invitee_exists","store"],"x-typelizer":true},"LineItem":{"type":"object","properties":{"id":{"type":"string"},"variant_id":{"type":"string"},"preorder":{"type":"boolean"},"preorder_ships_at":{"type":"string","nullable":true},"quantity":{"type":"number"},"currency":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"options_text":{"type":"string"},"price":{"type":"string"},"display_price":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"adjustment_total":{"type":"string"},"display_adjustment_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"pre_tax_amount":{"type":"string"},"display_pre_tax_amount":{"type":"string"},"discounted_amount":{"type":"string"},"display_discounted_amount":{"type":"string"},"display_compare_at_amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"thumbnail_url":{"type":"string","nullable":true},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"digital_links":{"type":"array","items":{"$ref":"#/components/schemas/DigitalLink"}},"tax_lines":{"type":"array","items":{"$ref":"#/components/schemas/TaxLine"}},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"cost_price":{"type":"string","nullable":true},"tax_category_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"tax_category":{"$ref":"#/components/schemas/TaxCategory"}},"required":["id","variant_id","preorder","preorder_ships_at","quantity","currency","name","slug","options_text","price","display_price","total","display_total","adjustment_total","display_adjustment_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","discount_total","display_discount_total","pre_tax_amount","display_pre_tax_amount","discounted_amount","display_discounted_amount","display_compare_at_amount","compare_at_amount","thumbnail_url","option_values","digital_links","metadata","created_at","updated_at","cost_price","tax_category_id"],"x-typelizer":true},"Market":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"currency":{"type":"string"},"default_locale":{"type":"string"},"tax_inclusive":{"type":"boolean"},"default":{"type":"boolean"},"country_isos":{"type":"array","items":{"type":"string"}},"supported_locales":{"type":"array","items":{"type":"string"}},"countries":{"type":"array","items":{"$ref":"#/components/schemas/Country"}},"tax_provider":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","currency","default_locale","tax_inclusive","default","country_isos","supported_locales","tax_provider","created_at","updated_at"],"x-typelizer":true},"Media":{"type":"object","properties":{"id":{"type":"string"},"product_id":{"type":"string","nullable":true},"variant_ids":{"type":"array","items":{"type":"string"}},"position":{"type":"number"},"alt":{"type":"string","nullable":true},"media_type":{"type":"string"},"focal_point_x":{"type":"number","nullable":true},"focal_point_y":{"type":"number","nullable":true},"external_video_url":{"type":"string","nullable":true},"original_url":{"type":"string","nullable":true},"mini_url":{"type":"string","nullable":true},"small_url":{"type":"string","nullable":true},"medium_url":{"type":"string","nullable":true},"large_url":{"type":"string","nullable":true},"xlarge_url":{"type":"string","nullable":true},"og_image_url":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"viewable_id":{"type":"string"},"download_url":{"type":"string","nullable":true},"metadata":{"type":"object"},"viewable_type":{"type":"string"}},"required":["id","product_id","variant_ids","position","alt","media_type","focal_point_x","focal_point_y","external_video_url","original_url","mini_url","small_url","medium_url","large_url","xlarge_url","og_image_url","created_at","updated_at","viewable_id","download_url","metadata","viewable_type"],"x-typelizer":true},"NewsletterSubscriber":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"verified":{"type":"boolean"},"verified_at":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true}},"required":["id","email","created_at","updated_at","verified","verified_at","customer_id"],"x-typelizer":true},"OptionType":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"number"},"kind":{"type":"string"},"translations":{"type":"object"},"metadata":{"type":"object"},"filterable":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}}},"required":["id","name","label","position","kind","metadata","filterable","created_at","updated_at"],"x-typelizer":true},"OptionValue":{"type":"object","properties":{"id":{"type":"string"},"option_type_id":{"type":"string"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"number"},"color_code":{"type":"string","nullable":true},"option_type_name":{"type":"string"},"option_type_label":{"type":"string"},"image_url":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"option_type":{"$ref":"#/components/schemas/OptionType"}},"required":["id","option_type_id","name","label","position","color_code","option_type_name","option_type_label","image_url","metadata","created_at","updated_at"],"x-typelizer":true},"OrderRoutingRule":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"number"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"channel_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"},"label":{"type":"string"},"description":{"type":"string"}},"required":["id","position","active","created_at","updated_at","type","channel_id","preferences","preference_schema","label","description"],"x-typelizer":true},"Order":{"type":"object","properties":{"id":{"type":"string"},"market_id":{"type":"string","nullable":true},"cart_id":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"number":{"type":"string"},"email":{"type":"string"},"customer_note":{"type":"string","nullable":true},"currency":{"type":"string"},"locale":{"type":"string","nullable":true},"total_quantity":{"type":"number"},"coupon_code":{"type":"string","nullable":true},"fulfillment_status":{"type":"string","nullable":true},"payment_status":{"type":"string","nullable":true},"completed_at":{"type":"string","nullable":true},"item_total":{"type":"string"},"display_item_total":{"type":"string"},"adjustment_total":{"type":"string"},"display_adjustment_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"gift_card_total":{"type":"string"},"display_gift_card_total":{"type":"string"},"amount_due":{"type":"string"},"display_amount_due":{"type":"string"},"delivery_total":{"type":"string"},"display_delivery_total":{"type":"string"},"store_credit_total":{"type":"string"},"display_store_credit_total":{"type":"string"},"covered_by_store_credit":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"}},"fulfillments":{"type":"array","items":{"$ref":"#/components/schemas/Fulfillment"}},"payments":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}},"billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"gift_card":{"allOf":[{"$ref":"#/components/schemas/GiftCard"}],"nullable":true},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true},"status":{"type":"string"},"last_ip_address":{"type":"string","nullable":true},"considered_risky":{"type":"boolean"},"confirmation_delivered":{"type":"boolean"},"store_owner_notification_delivered":{"type":"boolean"},"payment_total":{"type":"string"},"display_payment_total":{"type":"string"},"metadata":{"type":"object"},"canceled_at":{"type":"string","nullable":true},"approved_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preferred_stock_location_id":{"type":"string","nullable":true},"company_location_id":{"type":"string","nullable":true},"company_id":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"}},"internal_note":{"type":"string","nullable":true},"internal_note_html":{"type":"string","nullable":true},"approver_id":{"type":"string","nullable":true},"canceler_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true},"applied_promotions":{"type":"array","items":{"$ref":"#/components/schemas/AppliedPromotion"}},"cart":{"$ref":"#/components/schemas/Cart"},"channel":{"$ref":"#/components/schemas/Channel"},"preferred_stock_location":{"$ref":"#/components/schemas/StockLocation"},"payment_methods":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethod"}},"customer":{"$ref":"#/components/schemas/Customer"},"approver":{"$ref":"#/components/schemas/Customer"},"canceler":{"$ref":"#/components/schemas/Customer"},"created_by":{"$ref":"#/components/schemas/Customer"},"returns":{"type":"array","items":{"$ref":"#/components/schemas/Return"}},"exchanges":{"type":"array","items":{"$ref":"#/components/schemas/Exchange"}},"claims":{"type":"array","items":{"$ref":"#/components/schemas/Claim"}}},"required":["id","market_id","cart_id","channel_id","number","email","customer_note","currency","locale","total_quantity","coupon_code","fulfillment_status","payment_status","completed_at","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","store_credit_total","display_store_credit_total","covered_by_store_credit","gift_card","market","status","last_ip_address","considered_risky","confirmation_delivered","store_owner_notification_delivered","payment_total","display_payment_total","metadata","canceled_at","approved_at","created_at","updated_at","preferred_stock_location_id","company_location_id","company_id","tags","internal_note","internal_note_html","approver_id","canceler_id","created_by_id","customer_id"],"x-typelizer":true},"PaymentMethod":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"type":{"type":"string"},"session_required":{"type":"boolean"},"source_required":{"type":"boolean"},"metadata":{"type":"object"},"active":{"type":"boolean"},"auto_capture":{"type":"boolean","nullable":true},"capture_method":{"type":"string","enum":["checkout","on_dispatch","manual"],"nullable":true},"resolved_capture_method":{"type":"string","enum":["checkout","on_dispatch","manual"]},"storefront_visible":{"type":"boolean"},"position":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"}},"required":["id","name","description","type","session_required","source_required","metadata","active","auto_capture","capture_method","resolved_capture_method","storefront_visible","position","created_at","updated_at","preferences","preference_schema"],"x-typelizer":true},"Payment":{"type":"object","properties":{"id":{"type":"string"},"payment_method_id":{"type":"string"},"response_code":{"type":"string","nullable":true},"number":{"type":"string"},"amount":{"type":"string"},"display_amount":{"type":"string"},"status":{"type":"string"},"source_type":{"type":"string","nullable":true,"enum":["credit_card","store_credit","payment_source"]},"source_id":{"type":"string","nullable":true},"source":{"anyOf":[{"$ref":"#/components/schemas/CreditCard"},{"$ref":"#/components/schemas/StoreCredit"},{"$ref":"#/components/schemas/PaymentSource"}],"nullable":true},"payment_method":{"$ref":"#/components/schemas/PaymentMethod"},"metadata":{"type":"object"},"avs_response":{"type":"string","nullable":true},"cvv_response_code":{"type":"string","nullable":true},"cvv_response_message":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"captured_amount":{"type":"string"},"order_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","payment_method_id","response_code","number","amount","display_amount","status","source_type","source_id","source","metadata","avs_response","cvv_response_code","cvv_response_message","created_at","updated_at","captured_amount","order_id"],"x-typelizer":true},"PaymentSource":{"type":"object","properties":{"id":{"type":"string"},"gateway_payment_profile_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","gateway_payment_profile_id","metadata","created_at","updated_at"],"x-typelizer":true},"Permission":{"type":"object","properties":{"key":{"type":"string"},"resource":{"type":"string"},"kind":{"type":"string"},"group":{"type":"string"},"group_label":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"}},"required":["key","resource","kind","group","group_label","label","description"],"x-typelizer":true},"PriceHistory":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string"},"amount_in_cents":{"type":"number"},"currency":{"type":"string"},"display_amount":{"type":"string"},"recorded_at":{"type":"string"},"variant_id":{"type":"string"},"price_id":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true},"created_at":{"type":"string"}},"required":["id","amount","amount_in_cents","currency","display_amount","recorded_at","variant_id","price_id","compare_at_amount","created_at"],"x-typelizer":true},"PriceList":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"position":{"type":"number"},"match_policy":{"type":"string"},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"currently_active":{"type":"boolean"},"products_count":{"type":"number"},"prices_count":{"type":"number"},"product_ids":{"type":"array","items":{"type":"string"}},"price_rules":{"type":"array","items":{"$ref":"#/components/schemas/PriceRule"}}},"required":["id","name","description","status","position","match_policy","starts_at","ends_at","deleted_at","created_at","updated_at","currently_active","products_count","prices_count","product_ids"],"x-typelizer":true},"PriceRule":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"price_list_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"description":{"type":"string","nullable":true},"markets":{"type":"array","items":{"$ref":"#/components/schemas/Market"}},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}},"required":["id","created_at","updated_at","type","price_list_id","preferences","preference_schema","label","description"],"x-typelizer":true},"Price":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string","nullable":true},"amount_in_cents":{"type":"number","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"compare_at_amount_in_cents":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"display_amount":{"type":"string","nullable":true},"display_compare_at_amount":{"type":"string","nullable":true},"price_list_id":{"type":"string","nullable":true},"variant_id":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","amount","amount_in_cents","compare_at_amount","compare_at_amount_in_cents","currency","display_amount","display_compare_at_amount","price_list_id","variant_id","created_at","updated_at"],"x-typelizer":true},"ProductPublication":{"type":"object","properties":{"id":{"type":"string"},"published_at":{"type":"string","nullable":true},"unpublished_at":{"type":"string","nullable":true},"product_id":{"type":"string"},"channel_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","published_at","unpublished_at","product_id","channel_id","created_at","updated_at"],"x-typelizer":true},"Product":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"variant_count":{"type":"number"},"available_on":{"type":"string","nullable":true},"preorder_ships_at":{"type":"string","nullable":true},"purchasable":{"type":"boolean"},"preorder":{"type":"boolean"},"in_stock":{"type":"boolean"},"backorderable":{"type":"boolean"},"available":{"type":"boolean"},"description":{"type":"string","nullable":true},"description_html":{"type":"string","nullable":true},"default_variant_id":{"type":"string"},"thumbnail_url":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"}},"price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"original_price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"primary_media":{"$ref":"#/components/schemas/Media"},"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"}},"variants":{"type":"array","items":{"$ref":"#/components/schemas/Variant"}},"default_variant":{"$ref":"#/components/schemas/Variant"},"option_types":{"type":"array","items":{"$ref":"#/components/schemas/OptionType"}},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"prior_price":{"allOf":[{"$ref":"#/components/schemas/PriceHistory"}],"nullable":true},"translations":{"type":"object"},"status":{"type":"string"},"metadata":{"type":"object"},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"product_type_id":{"type":"string","nullable":true},"tax_category_id":{"type":"string","nullable":true},"collections":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}},"product_publications":{"type":"array","items":{"$ref":"#/components/schemas/ProductPublication"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"product_type":{"$ref":"#/components/schemas/ProductType"}},"required":["id","name","slug","meta_title","meta_description","meta_keywords","variant_count","available_on","preorder_ships_at","purchasable","preorder","in_stock","backorderable","available","description","description_html","default_variant_id","thumbnail_url","tags","price","original_price","status","metadata","deleted_at","created_at","updated_at","delivery_profile_id","product_type_id","tax_category_id"],"x-typelizer":true},"ProductTypeCustomFieldDefinition":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"namespace":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"required":{"type":"boolean"},"sort_order":{"type":"number"}},"required":["id","key","namespace","label","field_type","required","sort_order"],"x-typelizer":true},"ProductType":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"translations":{"type":"object"},"products_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"option_type_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"custom_field_definitions":{"type":"array","items":{"$ref":"#/components/schemas/ProductTypeCustomFieldDefinition"}}},"required":["id","name","products_count","created_at","updated_at","delivery_profile_id","option_type_ids","category_ids","custom_field_definitions"],"x-typelizer":true},"PromotionAction":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"promotion_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"calculator":{"allOf":[{"$ref":"#/components/schemas/PromotionActionCalculator"}],"nullable":true},"line_items":{"type":"array","items":{"$ref":"#/components/schemas/PromotionActionLineItem"},"nullable":true}},"required":["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","calculator","line_items"],"x-typelizer":true},"PromotionRule":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"promotion_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"product_ids":{"type":"array","items":{"type":"string"},"nullable":true},"category_ids":{"type":"array","items":{"type":"string"},"nullable":true},"customer_ids":{"type":"array","items":{"type":"string"},"nullable":true},"products":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"countries":{"type":"array","items":{"$ref":"#/components/schemas/Country"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"markets":{"type":"array","items":{"$ref":"#/components/schemas/Market"}}},"required":["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","product_ids","category_ids","customer_ids"],"x-typelizer":true},"Promotion":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"expires_at":{"type":"string","nullable":true},"usage_limit":{"type":"number","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"path":{"type":"string","nullable":true},"kind":{"type":"string","enum":["coupon_code","automatic"]},"multi_codes":{"type":"boolean"},"number_of_codes":{"type":"number","nullable":true},"code_prefix":{"type":"string","nullable":true},"promotion_category_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"action_ids":{"type":"array","items":{"type":"string"}},"rule_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","description","code","starts_at","expires_at","usage_limit","match_policy","path","kind","multi_codes","number_of_codes","code_prefix","promotion_category_id","metadata","created_at","updated_at","action_ids","rule_ids"],"x-typelizer":true},"RefundReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Refund":{"type":"object","properties":{"id":{"type":"string"},"transaction_id":{"type":"string","nullable":true},"amount":{"type":"string","nullable":true},"payment_id":{"type":"string","nullable":true},"refund_reason_id":{"type":"string","nullable":true},"originator_id":{"type":"string","nullable":true},"originator_type":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"payment":{"$ref":"#/components/schemas/Payment"}},"required":["id","transaction_id","amount","payment_id","refund_reason_id","originator_id","originator_type","metadata","created_at","updated_at"],"x-typelizer":true},"ReturnLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"received_quantity":{"type":"number"},"resellable":{"type":"boolean"},"pre_tax_amount":{"type":"string"},"display_pre_tax_amount":{"type":"string"},"variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_item_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"line_item":{"$ref":"#/components/schemas/LineItem"}},"required":["id","quantity","received_quantity","resellable","pre_tax_amount","display_pre_tax_amount","variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":true},"ReturnReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Return":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"refund_total":{"type":"string"},"display_refund_total":{"type":"string"},"approved_at":{"type":"string","nullable":true},"received_at":{"type":"string","nullable":true},"refunded_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ReturnReason"},"return_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ReturnLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"refunded_total":{"type":"string"},"refundable_total":{"type":"string"},"order":{"$ref":"#/components/schemas/Order"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","order_id","reason_id","refund_total","display_refund_total","approved_at","received_at","refunded_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id","refunded_total","refundable_total"],"x-typelizer":true},"Role":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"permissions":{"type":"array","items":{"type":"string"}},"mutable":{"type":"boolean"},"users_count":{"type":"number"}},"required":["id","name","description","created_at","updated_at","permissions","mutable","users_count"],"x-typelizer":true},"SetupTask":{"type":"object","properties":{"name":{"type":"string"},"done":{"type":"boolean"}},"required":["name","done"],"x-typelizer":true},"State":{"type":"object","properties":{"abbr":{"type":"string"},"name":{"type":"string"}},"required":["abbr","name"],"x-typelizer":true},"StockItem":{"type":"object","properties":{"id":{"type":"string"},"count_on_hand":{"type":"number"},"backorderable":{"type":"boolean"},"stock_location_id":{"type":"string","nullable":true},"variant_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"allocated_count":{"type":"number"},"available_count":{"type":"number"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","count_on_hand","backorderable","stock_location_id","variant_id","metadata","created_at","updated_at","allocated_count","available_count"],"x-typelizer":true},"StockLocation":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"address1":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"country_iso":{"type":"string","nullable":true},"country_name":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"state_text":{"type":"string","nullable":true},"pickup_ready_in_minutes":{"type":"number","nullable":true},"pickup_instructions":{"type":"string","nullable":true},"admin_name":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"active":{"type":"boolean"},"default":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"propagate_all_variants":{"type":"boolean"},"kind":{"type":"string"},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","address1","city","zipcode","country_iso","country_name","state_code","state_text","pickup_ready_in_minutes","pickup_instructions","admin_name","address2","state_name","phone","company","active","default","backorderable_default","propagate_all_variants","kind","pickup_enabled","pickup_stock_policy","created_at","updated_at"],"x-typelizer":true},"StockReservation":{"type":"object","properties":{"id":{"type":"string"},"stock_item_id":{"type":"string"},"line_item_id":{"type":"string"},"order_id":{"type":"string"},"variant_id":{"type":"string","nullable":true},"stock_location_id":{"type":"string","nullable":true},"quantity":{"type":"number"},"expires_at":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","stock_item_id","line_item_id","order_id","variant_id","stock_location_id","quantity","expires_at","active","created_at","updated_at"],"x-typelizer":true},"StockTransfer":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"reference":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"source_location_id":{"type":"string","nullable":true},"destination_location_id":{"type":"string","nullable":true},"source_location":{"$ref":"#/components/schemas/StockLocation"},"destination_location":{"$ref":"#/components/schemas/StockLocation"}},"required":["id","number","reference","metadata","created_at","updated_at","source_location_id","destination_location_id"],"x-typelizer":true},"StoreCreditCategory":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"non_expiring":{"type":"boolean"}},"required":["id","name","created_at","updated_at","non_expiring"],"x-typelizer":true},"StoreCredit":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string"},"amount_used":{"type":"string"},"amount_remaining":{"type":"string"},"display_amount":{"type":"string"},"display_amount_used":{"type":"string"},"display_amount_remaining":{"type":"string"},"currency":{"type":"string"},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"category_id":{"type":"string","nullable":true},"category_name":{"type":"string","nullable":true}},"required":["id","amount","amount_used","amount_remaining","display_amount","display_amount_used","display_amount_remaining","currency","memo","metadata","created_at","updated_at","customer_id","created_by_id","category_id","category_name"],"x-typelizer":true},"Store":{"type":"object","properties":{"id":{"type":"string"},"metadata":{"type":"object"},"name":{"type":"string"},"code":{"type":"string"},"preferred_storefront_url":{"type":"string","nullable":true},"default_currency":{"type":"string"},"default_locale":{"type":"string"},"mail_from_address":{"type":"string","nullable":true},"customer_support_email":{"type":"string","nullable":true},"new_order_notifications_email":{"type":"string","nullable":true},"preferred_send_consumer_transactional_emails":{"type":"boolean"},"preferred_admin_locale":{"type":"string","nullable":true},"preferred_timezone":{"type":"string"},"preferred_weight_unit":{"type":"string"},"preferred_default_package_weight":{"type":"number"},"preferred_default_package_length":{"type":"number"},"preferred_default_package_width":{"type":"number"},"preferred_default_package_height":{"type":"number"},"preferred_unit_system":{"type":"string"},"preferred_storefront_access":{"type":"string"},"preferred_guest_checkout":{"type":"boolean"},"preferred_company_field_enabled":{"type":"boolean"},"preferred_address_requires_company":{"type":"boolean"},"preferred_address_requires_phone":{"type":"boolean"},"preferred_capture_method":{"type":"string"},"preferred_track_inventory_levels":{"type":"boolean"},"preferred_stock_reservations_enabled":{"type":"boolean"},"preferred_track_price_history":{"type":"boolean"},"preferred_show_products_without_price":{"type":"boolean"},"preferred_disable_sku_validation":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string"},"preferred_document_number_format":{"type":"string"},"preferred_order_number_prefix":{"type":"string"},"preferred_order_number_suffix":{"type":"string"},"preferred_order_number_sequence_start":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"order_number_sequence_started":{"type":"boolean"},"url":{"type":"string"},"api_url":{"type":"string"},"setup_tasks":{"type":"array","items":{"$ref":"#/components/schemas/SetupTask"}},"supported_currencies":{"type":"array","items":{"type":"string"}},"supported_locales":{"type":"array","items":{"type":"string"}},"available_locales":{"type":"array","items":{"type":"string"}},"logo_url":{"type":"string","nullable":true},"mailer_logo_url":{"type":"string","nullable":true}},"required":["id","metadata","name","code","preferred_storefront_url","default_currency","default_locale","mail_from_address","customer_support_email","new_order_notifications_email","preferred_send_consumer_transactional_emails","preferred_admin_locale","preferred_timezone","preferred_weight_unit","preferred_default_package_weight","preferred_default_package_length","preferred_default_package_width","preferred_default_package_height","preferred_unit_system","preferred_storefront_access","preferred_guest_checkout","preferred_company_field_enabled","preferred_address_requires_company","preferred_address_requires_phone","preferred_capture_method","preferred_track_inventory_levels","preferred_stock_reservations_enabled","preferred_track_price_history","preferred_show_products_without_price","preferred_disable_sku_validation","preferred_order_routing_strategy","preferred_document_number_format","preferred_order_number_prefix","preferred_order_number_suffix","preferred_order_number_sequence_start","created_at","updated_at","order_number_sequence_started","url","api_url","setup_tasks","supported_currencies","supported_locales","available_locales","logo_url","mailer_logo_url"],"x-typelizer":true},"TaxCategory":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"tax_code":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"is_default":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","tax_code","description","is_default","created_at","updated_at"],"x-typelizer":true},"TaxExemptionCertificate":{"type":"object","properties":{"id":{"type":"string"},"certificate_number":{"type":"string"},"reason_code":{"type":"string"},"status":{"type":"string"},"issuing_authority":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"issued_at":{"type":"string"},"expires_at":{"type":"string"},"verified_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_id":{"type":"string"},"country_iso":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"active":{"type":"boolean"},"lapsed":{"type":"boolean"},"can_be_deleted":{"type":"boolean"},"document_filename":{"type":"string","nullable":true},"document_byte_size":{"type":"number","nullable":true},"document_url":{"type":"string","nullable":true}},"required":["id","certificate_number","reason_code","status","issuing_authority","metadata","issued_at","expires_at","verified_at","created_at","updated_at","company_id","country_iso","state_code","active","lapsed","can_be_deleted","document_filename","document_byte_size","document_url"],"x-typelizer":true},"TaxIdentifier":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"value":{"type":"string"},"validation_status":{"type":"string","nullable":true},"validation_evidence":{"type":"object","nullable":true},"source":{"type":"string","nullable":true},"validated_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"validatable":{"type":"boolean"},"customer_id":{"type":"string","nullable":true},"cart_id":{"type":"string","nullable":true},"order_id":{"type":"string","nullable":true}},"required":["id","kind","value","validation_status","validation_evidence","source","validated_at","created_at","updated_at","validatable","customer_id","cart_id","order_id"],"x-typelizer":true},"TaxLine":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"included":{"type":"boolean"},"rate":{"type":"string"},"tax_rate_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"fee_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"provider_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"taxability_reason":{"type":"string","nullable":true},"country_iso":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"data":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","included","rate","tax_rate_id","line_item_id","fulfillment_id","fee_id","amount","display_amount","provider_id","metadata","taxability_reason","country_iso","state_code","data","created_at","updated_at"],"x-typelizer":true},"TaxRate":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string","nullable":true},"amount":{"type":"string"},"amount_percentage":{"type":"number","nullable":true},"tax_category_id":{"type":"string","nullable":true},"store_id":{"type":"string","nullable":true},"country_iso":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true}},"required":["id","name","included_in_price","show_rate_in_label","metadata","created_at","updated_at","deleted_at","amount","amount_percentage","tax_category_id","store_id","country_iso","state_code"],"x-typelizer":true},"Variant":{"type":"object","properties":{"id":{"type":"string"},"product_id":{"type":"string"},"sku":{"type":"string","nullable":true},"options_text":{"type":"string"},"track_inventory":{"type":"boolean"},"media_count":{"type":"number"},"preorder_ships_at":{"type":"string","nullable":true},"thumbnail_url":{"type":"string","nullable":true},"purchasable":{"type":"boolean"},"in_stock":{"type":"boolean"},"backorderable":{"type":"boolean"},"preorder":{"type":"boolean"},"weight":{"type":"number","nullable":true},"height":{"type":"number","nullable":true},"width":{"type":"number","nullable":true},"depth":{"type":"number","nullable":true},"price":{"$ref":"#/components/schemas/Price"},"original_price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"primary_media":{"$ref":"#/components/schemas/Media"},"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"}},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"prior_price":{"allOf":[{"$ref":"#/components/schemas/PriceHistory"}],"nullable":true},"metadata":{"type":"object"},"position":{"type":"number"},"cost_price":{"type":"string","nullable":true},"cost_currency":{"type":"string","nullable":true},"barcode":{"type":"string","nullable":true},"weight_unit":{"type":"string","nullable":true},"dimensions_unit":{"type":"string","nullable":true},"backorder_limit":{"type":"number","nullable":true},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preorderable":{"type":"boolean"},"tax_category_id":{"type":"string","nullable":true},"available_stock":{"type":"number","nullable":true},"reserved_quantity":{"type":"number"},"total_on_hand":{"type":"number","nullable":true},"product_name":{"type":"string"},"prices":{"type":"array","items":{"$ref":"#/components/schemas/Price"}},"stock_items":{"type":"array","items":{"$ref":"#/components/schemas/StockItem"}}},"required":["id","product_id","sku","options_text","track_inventory","media_count","preorder_ships_at","thumbnail_url","purchasable","in_stock","backorderable","preorder","weight","height","width","depth","price","original_price","option_values","metadata","position","cost_price","cost_currency","barcode","weight_unit","dimensions_unit","backorder_limit","deleted_at","created_at","updated_at","preorderable","tax_category_id","available_stock","reserved_quantity","total_on_hand","product_name"],"x-typelizer":true},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string"},"event_name":{"type":"string"},"event_id":{"type":"string","nullable":true},"response_code":{"type":"number","nullable":true},"execution_time":{"type":"number","nullable":true},"error_type":{"type":"string","nullable":true},"request_errors":{"type":"string","nullable":true},"response_body":{"type":"string","nullable":true},"success":{"type":"boolean","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivered_at":{"type":"string","nullable":true},"payload":{"type":"object"},"webhook_endpoint_id":{"type":"string"},"webhook_endpoint_url":{"type":"string"}},"required":["id","event_name","event_id","response_code","execution_time","error_type","request_errors","response_body","success","created_at","updated_at","delivered_at","payload","webhook_endpoint_id","webhook_endpoint_url"],"x-typelizer":true},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}},"disabled_reason":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"disabled_at":{"type":"string","nullable":true},"secret_key":{"type":"string","nullable":true},"last_delivery_at":{"type":"string","nullable":true},"recent_delivery_count":{"type":"number"},"recent_failure_count":{"type":"number"},"total_delivery_count":{"type":"number"},"successful_delivery_count":{"type":"number"},"failed_delivery_count":{"type":"number"}},"required":["id","name","url","active","subscriptions","disabled_reason","created_at","updated_at","disabled_at","secret_key","last_delivery_at","recent_delivery_count","recent_failure_count","total_delivery_count","successful_delivery_count","failed_delivery_count"],"x-typelizer":true}}}}
\ No newline at end of file
+{"info":{"title":"Admin API","contact":{"name":"Spree Commerce","url":"https://spreecommerce.org","email":"[email protected]"},"description":"Spree Admin API v3 - Administrative API for managing products, orders, and store settings.\n\n## Authentication\n\nThe Admin API requires a secret API key passed in the `x-spree-api-key` header.\nSecret API keys can be generated in the Spree admin dashboard.\n\n## Response Format\n\nAll responses are JSON. List endpoints return paginated responses with `data` and `meta` keys.\nSingle resource endpoints return a flat JSON object.\n\n## Resource IDs\n\nEvery resource is identified by an opaque string ID (e.g. `prod_86Rf07xd4z`,\n`variant_k5nR8xLq`, `or_UkLWZg9DAJ`). Use these IDs everywhere — URL paths,\nrequest bodies, and Ransack filters all accept them directly.\n\n## Error Handling\n\nErrors return a consistent format:\n```json\n{\n \"error\": {\n \"code\": \"validation_error\",\n \"message\": \"Validation failed\",\n \"details\": { \"name\": [\"can't be blank\"] }\n }\n}\n```\n","version":"v3"},"paths":{"/api/v3/admin/auth/login":{"post":{"summary":"Login","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Authenticates an admin user and returns a short-lived JWT access token.\nThe rotatable refresh token is set in an HttpOnly cookie — it is not\nincluded in the response body.\n\nThe `provider` field selects the authentication method. When omitted it\ndefaults to `email`, the built-in email/password login.\n\nTo authenticate against a third-party identity provider (Okta, Azure AD,\nGoogle Workspace SSO, a custom JWT issuer, SAML, etc.), send\n`{ \"provider\": \"<your_key>\", ... }` with the fields that provider\nrequires. The endpoint returns the same JWT regardless of which provider\nauthenticated the request. See\n[Custom API Authentication](https://spreecommerce.org/docs/developer/how-to/custom-api-authentication)\nfor the list of configured providers and their required fields.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"login successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"title":"EmailPasswordLogin","description":"Built-in email/password authentication (default when `provider` is omitted).","type":"object","properties":{"provider":{"type":"string","enum":["email"],"default":"email"},"email":{"type":"string","format":"email"},"password":{"type":"string"}},"required":["email","password"]},{"title":"ProviderLogin","description":"Provider-dispatched login. The `provider` key selects a configured\nauthentication provider; the remaining fields are forwarded to it.\nRequired fields depend on the provider — see\n[Custom API Authentication](https://spreecommerce.org/docs/developer/how-to/custom-api-authentication).\n","type":"object","properties":{"provider":{"type":"string","description":"Registered provider key (anything other than `email`).","not":{"enum":["email"]}}},"required":["provider"],"additionalProperties":true}]}}}}}},"/api/v3/admin/auth/refresh":{"post":{"summary":"Refresh token","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Exchanges the HttpOnly refresh-token cookie for a new access JWT and a\nrotated refresh token cookie. No request body or Authorization header\nis required — the cookie alone authenticates the call.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"refresh successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"missing or invalid refresh-token cookie","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/auth/logout":{"post":{"summary":"Logout","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Revokes the refresh-token cookie, effectively logging the admin out.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"logout successful"}}}},"/api/v3/admin/me":{"get":{"summary":"Get current admin user and permissions","tags":["Authentication"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the current admin user profile and a serialized list of permissions (CanCanCan rules). The SPA uses these to drive UI permission checks.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"current admin user and permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update the current admin profile","tags":["Authentication"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Self-service update of the signed-in admin's own profile, such as their admin UI display language (`selected_locale`).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"profile updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"selected_locale":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"}}}}}}}},"/api/v3/admin/auth/password_resets":{"post":{"summary":"Request password reset","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Requests a password reset email for an admin user. Always returns `202`\nwhether or not the email matches an account, to prevent enumeration.\n\n`redirect_url` is where the emailed link should point (the reset token\nis appended as a `token` query param). It must match one of the store's\nallowed origins — otherwise it is silently ignored and the server-side\ndefault is used. The email is delivered by Spree itself via the\n`admin_user.password_reset_requested` event; this event is never\nforwarded to webhook endpoints.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"reset requested","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"redirect_url":{"type":"string","description":"Must match an allowed origin of the store; ignored otherwise."}},"required":["email"]}}}}}},"/api/v3/admin/auth/password_resets/{id}":{"patch":{"summary":"Reset password","tags":["Authentication"],"security":[{"api_key":[]}],"description":"Consumes a password reset token (the `token` query param from the\nemailed link), sets the new password, and signs the admin in: the\nresponse carries a JWT access token and the rotatable refresh token is\nset in an HttpOnly cookie. The token is single-use — it invalidates as\nsoon as the password changes.\n","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","description":"The reset token from the emailed link","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"password reset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"422":{"description":"invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string"},"password_confirmation":{"type":"string"}},"required":["password","password_confirmation"]}}}}}},"/api/v3/admin/auth/setup":{"get":{"summary":"Check first-run setup availability","tags":["Authentication"],"description":"Reports whether first-run setup is still available — true only while\nthe installation has no admin user. Unauthenticated; the dashboard\nlogin page uses it to offer the setup screen.\n","responses":{"200":{"description":"setup status","content":{"application/json":{}}}}},"post":{"summary":"Complete first-run setup","tags":["Authentication"],"description":"Creates the first admin account and adopts the seeded store, authorized\nby the one-time setup token printed at install time (rotate it with\n`bin/rails spree:setup:token`). Issues a JWT access token and a\nrefresh-token cookie exactly like login. Returns 404 once any admin\nuser exists — the flow is closed permanently after setup.\n","parameters":[],"responses":{"200":{"description":"setup completed","content":{"application/json":{}}},"404":{"description":"setup not available","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["setup_token","email","password"],"properties":{"setup_token":{"type":"string","description":"One-time token from the install output."},"email":{"type":"string","format":"email"},"password":{"type":"string"},"password_confirmation":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"store_name":{"type":"string"},"currency":{"type":"string","description":"ISO currency code for the store."},"country_code":{"type":"string","description":"ISO 3166-1 alpha-2 country code for the store."}}}}}}}},"/api/v3/admin/allowed_origins":{"get":{"summary":"List allowed origins","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the CORS allowlist for the current store. Each entry is a\nbare `scheme://host[:port]` permitted to call the admin API from a\nbrowser. Backs the `Rack::Cors` allowlist and the CSRF boundary of\nthe admin cookie session (see\n`docs/plans/5.5-admin-auth-cookie-refresh.md`).\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[origin_cont]","in":"query","required":false,"description":"Filter by origin (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origins found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AllowedOrigin"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds an origin to the admin CORS allowlist. The value must be a bare\n`scheme://host[:port]` (no path, query, or fragment) and use `http` or\n`https`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"allowed origin created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"origin":{"type":"string"}},"required":["origin"]}}}}}},"/api/v3/admin/allowed_origins/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Allowed origin ID","schema":{"type":"string"}}],"get":{"summary":"Get an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single allowed origin by prefixed ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origin found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"404":{"description":"allowed origin not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing allowed origin.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"allowed origin updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedOrigin"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"origin":{"type":"string"}}}}}}},"delete":{"summary":"Delete an allowed origin","tags":["Allowed Origins"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes an origin from the admin CORS allowlist. After deletion the\nadmin SPA running at that origin will no longer be able to call the\nadmin API from a browser.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"allowed origin deleted"}}}},"/api/v3/admin/api_keys":{"get":{"summary":"List API keys","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns publishable and secret API keys for the current store. Secret keys are listed by `token_prefix` only — the plaintext token is delivered exactly once on create.\n\n**Required scope:** `read_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API keys found","content":{"application/json":{}}}}},"post":{"summary":"Create an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a publishable or secret API key. The plaintext token is included in the response **once** for secret keys; publishable keys expose their token on every read since they are intended for client-side use.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"secret key created — plaintext token returned once","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","key_type"],"properties":{"name":{"type":"string"},"key_type":{"type":"string","enum":["publishable","secret"]},"scopes":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/api_keys/{id}":{"get":{"summary":"Show an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key found","content":{"application/json":{}}}}},"patch":{"summary":"Update an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Renames a key. `key_type` and `scopes` are fixed at creation — to change a key's authority, create a new key and revoke the old one.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key renamed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}}},"delete":{"summary":"Delete an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"API key deleted"}}}},"/api/v3/admin/api_keys/current":{"get":{"summary":"Describe the current API key","tags":["API Keys"],"security":[{"api_key":[]}],"description":"Returns the secret key that authenticated this request, including its live scopes. Useful to confirm a key's real, current authority. Only secret-key principals have a single key to describe.\n\n**Required scope:** none — any key can describe itself (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"current API key","content":{"application/json":{}}}}}},"/api/v3/admin/api_keys/{id}/revoke":{"patch":{"summary":"Revoke an API key","tags":["API Keys"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Marks the key revoked. Future requests using its token will fail; the row is preserved for audit.\n\n**Required scope:** `write_api_keys` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API key revoked","content":{"application/json":{}}}}}},"/api/v3/admin/categories":{"get":{"summary":"List categories","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of the store's categories (manual hierarchical taxons; rule-based collections are excluded).\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., children, parent, ancestors).","schema":{"type":"string"}}],"responses":{"200":{"description":"categories found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a category. Nests under the parent when parent_id is given, otherwise creates a top-level category.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"category created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"parent_id":{"type":"string","description":"Prefixed ID of the parent category"},"description":{"type":"string"},"permalink":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"}},"required":["name"]}}}}}},"/api/v3/admin/categories/{id}":{"get":{"summary":"Get a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single category by ID.\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., children, parent, ancestors).","schema":{"type":"string"}}],"responses":{"200":{"description":"category found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}},"404":{"description":"category not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a category.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"category updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"parent_id":{"type":"string","description":"Prefixed ID of the parent category"},"description":{"type":"string"},"permalink":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"}}}}}}},"delete":{"summary":"Delete a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a category and its descendants.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"204":{"description":"category deleted"}}}},"/api/v3/admin/categories/{id}/reposition":{"patch":{"summary":"Reposition a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a category to a new parent and/or index within the tree.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"category repositioned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_parent_id":{"type":"string","description":"Prefixed ID of the new parent (omit for top level)"},"new_position":{"type":"integer","description":"0-based index among the new parent's children"}},"required":["new_position"]}}}}}},"/api/v3/admin/categories/{category_id}/products":{"get":{"summary":"List category products","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Products classified under the category, ordered by their classification position.\n\n**Required scope:** `read_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Add a product to a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Classifies a product under the category (appended to the end).\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}}],"responses":{"201":{"description":"product added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"string"}},"required":["product_id"]}}}}}},"/api/v3/admin/categories/{category_id}/products/{id}":{"delete":{"summary":"Remove a product from a category","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes a product from the category's manual classification.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product removed"}}}},"/api/v3/admin/categories/{category_id}/products/{id}/reposition":{"patch":{"summary":"Reposition a category product","tags":["Categories"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a product to a new index among the category's products.\n\n**Required scope:** `write_categories` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"category_id","in":"path","required":true,"description":"Category ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product repositioned"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_position":{"type":"integer","description":"0-based index among the category's products"}},"required":["new_position"]}}}}}},"/api/v3/admin/channels":{"get":{"summary":"List channels","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the channels configured for the current store.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"channels found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new channel on the current store. `code` is normalized to a\nURL-safe slug (`Point of Sale` → `point-of-sale`); when omitted it's\nderived from `name`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"channel created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"code":{"type":"string","description":"Slug — auto-derived from `name` when blank."},"active":{"type":"boolean","default":true},"default":{"type":"boolean","default":false},"preferred_order_routing_strategy":{"type":"string","nullable":true,"description":"Routing strategy class name. `null` inherits the store setting."},"preferred_storefront_access":{"type":"string","nullable":true,"enum":["public","prices_hidden","login_required"],"description":"Anonymous-visitor access posture. `null` inherits the store setting."},"preferred_guest_checkout":{"type":"boolean","nullable":true,"description":"Whether guests can check out without an account. `null` inherits the store setting."}}}}}}}},"/api/v3/admin/channels/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"channel found","content":{"application/json":{}}}}},"patch":{"summary":"Update a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"channel updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string"},"active":{"type":"boolean"},"default":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string","nullable":true,"description":"Routing strategy class name. `null` inherits the store setting."},"preferred_storefront_access":{"type":"string","nullable":true,"enum":["public","prices_hidden","login_required"],"description":"Anonymous-visitor access posture. `null` inherits the store setting."},"preferred_guest_checkout":{"type":"boolean","nullable":true,"description":"Whether guests can check out without an account. `null` inherits the store setting."}}}}}}},"delete":{"summary":"Delete a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"channel deleted"}}}},"/api/v3/admin/channels/{id}/add_products":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Publish products on a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes the listed products on this channel. Idempotent — re-publishing\nan already-published product updates its publication window. Products from\nsibling stores are silently dropped.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products published","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["product_ids"],"properties":{"product_ids":{"type":"array","items":{"type":"string"}},"published_at":{"type":"string","format":"date-time","nullable":true,"description":"When the publications go live. `null` means immediately."},"unpublished_at":{"type":"string","format":"date-time","nullable":true,"description":"When the publications come down. `null` means never."}}}}}}}},"/api/v3/admin/channels/{id}/remove_products":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Unpublish products from a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Unpublishes the listed products from this channel.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products unpublished","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["product_ids"],"properties":{"product_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/channels/{channel_id}/order_routing_rules":{"parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List order routing rules for a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the channel's routing rules in priority order. The rules engine walks them top-down; see the Order Routing guide.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules found","content":{"application/json":{}}}}},"post":{"summary":"Create an order routing rule on a channel","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a rule to the channel's routing list. The `type` is the wire shorthand from `GET /order_routing_rules/types` (e.g. `preferred_location`). Omitting `position` appends the rule at the end of the list. Each rule kind can appear at most once per channel — a duplicate `type` is rejected with a validation error.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"rule created","content":{"application/json":{}}},"422":{"description":"unknown rule type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"active":{"type":"boolean"},"position":{"type":"integer"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/channels/{channel_id}/order_routing_rules/{id}":{"parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update an order routing rule","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a rule's `active` flag, `position` (the list reorders around it), or `preferences`. The rule kind cannot be changed — delete and re-create instead.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"},"position":{"type":"integer"},"preferences":{"type":"object","additionalProperties":true}}}}}}},"delete":{"summary":"Delete an order routing rule","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"rule deleted"}}}},"/api/v3/admin/order_routing_rules/types":{"get":{"summary":"List available order routing rule types","tags":["Channels"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Enumerates the registered rule kinds with their labels, descriptions and preference schemas — drives the \"Add rule\" picker in the admin dashboard. Plugins extend the list by registering `Spree::OrderRoutingRule` subclasses via `Spree.order_routing.rules`.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"types found","content":{"application/json":{}}}}}},"/api/v3/admin/custom_field_definitions":{"get":{"summary":"List custom field definitions","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all defined custom fields. Filter by `?q[resource_type_eq]=Spree::Product` to narrow to one parent type.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,label,field_type). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"definitions returned","content":{"application/json":{}}}}},"post":{"summary":"Create a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"definition created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["key","field_type","resource_type"],"properties":{"namespace":{"type":"string","description":"Defaults to `custom`"},"key":{"type":"string"},"label":{"type":"string","description":"Human-readable name; defaults to titleized `key`"},"field_type":{"type":"string","description":"Custom field type identifier (one of the registered field-type class names)."},"resource_type":{"type":"string","description":"Owner class, e.g. `Spree::Product`"},"storefront_visible":{"type":"boolean","description":"When false, the definition is admin-only and never exposed in the Store API"},"searchable":{"type":"boolean","description":"When true, values are included in storefront product text search"},"sortable":{"type":"boolean","description":"When true, storefront product listings can sort by this field"}}}}}}}},"/api/v3/admin/custom_field_definitions/{id}":{"get":{"summary":"Show a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,label,field_type). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"definition found","content":{"application/json":{}}}}},"patch":{"summary":"Update a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"definition updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"storefront_visible":{"type":"boolean"},"searchable":{"type":"boolean"},"sortable":{"type":"boolean"}}}}}}},"delete":{"summary":"Delete a custom field definition","tags":["Custom Fields"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes the definition and cascades to all custom field values referencing it.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"definition deleted"}}}},"/api/v3/admin/customer_groups":{"get":{"summary":"List customer groups","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer groups configured for the current store. Groups\nsegment customers for targeted promotions (see the `customer_group`\npromotion rule) and reporting. The list endpoint never embeds the\nmember list — fetch a single group with `?expand=customers` if you\nneed them inline, or query `/admin/customers?customer_group_id_in=…`\nfor paginated membership.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer groups found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a customer group in the current store. `customer_ids` is\noptional; when present, customers are attached at create time.\nPass prefixed IDs (e.g. `cus_…`) — the server decodes them\nautomatically.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"customer group created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"customer_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customer_groups/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Customer group prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single customer group. Pass `?expand=customers` to embed\nthe full member list inline (recommended only for single-record\nreads — embed cost scales with membership size).\n\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `customers`.","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer group with embedded customers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"404":{"description":"customer group not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name, description, or membership. `customer_ids` is a\nfull-set replacement — the server reconciles the membership to\nmatch the array, adding new IDs and removing ones not present.\nSend `customer_ids: []` to clear all members.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customer group updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroup"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"customer_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a customer group","tags":["Customer Groups"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the group. Member users are not deleted; their `customer_group_users` rows are dropped.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"customer group deleted"}}}},"/api/v3/admin/customers/{customer_id}/addresses":{"get":{"summary":"List customer addresses","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer's saved addresses.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., country, state). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., first_name,last_name,address1,city). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"addresses found","content":{"application/json":{}}}}},"post":{"summary":"Create a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new address to the customer's address book. Pass `is_default_billing: true` or `is_default_shipping: true` to set as the default — the previous default loses its flag in the same transaction.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"address created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"address2":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string","description":"ISO-2 country code (e.g. US)"},"state_code":{"type":"string","description":"State/province abbreviation (e.g. NY)"},"phone":{"type":"string"},"company":{"type":"string"},"label":{"type":"string"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"}}}}}}}},"/api/v3/admin/customers/{customer_id}/addresses/{id}":{"patch":{"summary":"Update a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a customer address.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"address updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"city":{"type":"string"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"}}}}}}},"delete":{"summary":"Delete a customer address","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes the address. If it was a default, the customer loses that default (no auto-promotion).\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"address deleted"}}}},"/api/v3/admin/customers/{customer_id}/credit_cards":{"get":{"summary":"List customer credit cards","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customer's saved credit cards. Useful for off-session admin charges via `POST /admin/orders/:id/payments { source_id }`.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., brand,last4,month,year). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"credit cards found","content":{"application/json":{}}}}}},"/api/v3/admin/customers/{customer_id}/credit_cards/{id}":{"get":{"summary":"Show a customer credit card","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a saved credit card by ID.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., brand,last4,month,year). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"credit card found","content":{"application/json":{}}}}},"delete":{"summary":"Delete a customer credit card","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a saved credit card.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"credit card deleted"}}}},"/api/v3/admin/customers/{customer_id}/store_credits":{"get":{"summary":"List customer store credits","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns store credits issued to the customer.\n\n**Required scope:** `read_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., category, store, created_by). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,amount_used,memo,currency). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credits found","content":{"application/json":{}}}}},"post":{"summary":"Issue a store credit to a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"`created_by` is set automatically from the authenticated admin.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"store credit created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["amount","currency","category_id"],"properties":{"amount":{"type":"string"},"currency":{"type":"string"},"category_id":{"type":"string","description":"StoreCreditCategory ID"},"memo":{"type":"string"}}}}}}}},"/api/v3/admin/customers/{customer_id}/store_credits/{id}":{"patch":{"summary":"Update a store credit","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Update memo / category / amount. The amount can only be changed if `amount_used == 0`.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"store credit updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string"},"category_id":{"type":"string"},"memo":{"type":"string"}}}}}}},"delete":{"summary":"Delete a store credit","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an unused store credit (amount_used == 0). Returns 422 otherwise.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"store credit deleted"}}}},"/api/v3/admin/customers":{"get":{"summary":"List customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of customers. Supports Ransack search/filters.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[search]","in":"query","required":false,"description":"Email + name full-text-ish search","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., addresses, store_credits). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., email,first_name,last_name). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customers found","content":{"application/json":{}}}}},"post":{"summary":"Create a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a customer. No welcome email is sent automatically.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"customer created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"},"accepts_email_marketing":{"type":"boolean"},"internal_note":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"}}}}}}}},"/api/v3/admin/customers/{id}":{"get":{"summary":"Show a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns full customer details including computed order stats (orders_count, total_spent, last_order_completed_at).\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Customer ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations: addresses, orders, store_credits, default_billing_address, default_shipping_address","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., email,first_name,last_name). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"customer found","content":{"application/json":{}}}}},"patch":{"summary":"Update a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates customer attributes. `tags` replaces the full set.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customer updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"},"accepts_email_marketing":{"type":"boolean"},"internal_note":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"}}}}}}},"delete":{"summary":"Delete a customer","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a customer. Returns 422 if the customer has any orders.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"customer deleted"}}}},"/api/v3/admin/customers/bulk_add_to_groups":{"post":{"summary":"Bulk-add customers to groups","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each customer in `ids` to every group in `customer_group_ids`.\nIdempotent — customers already in a group are skipped server-side.\nGroups from sibling stores are silently ignored. Returns counts of\ncustomers and groups that were processed (post store-scoping).\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customers added to groups","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"customer_group_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","customer_group_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_remove_from_groups":{"post":{"summary":"Bulk-remove customers from groups","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each customer in `ids` from every group in `customer_group_ids`.\nNo-op for non-members. Groups from sibling stores are silently ignored.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"customers removed from groups","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"customer_group_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","customer_group_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_add_tags":{"post":{"summary":"Bulk-add tags to customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds each tag name in `tags` to every customer in `ids`. Tags are\nupserted by name; re-adding an existing tag is a no-op.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags added","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/customers/bulk_remove_tags":{"post":{"summary":"Bulk-remove tags from customers","tags":["Customers"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes each tag name in `tags` from every customer in `ids`. No-op\nfor customers that don't carry the tag.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags removed","content":{"application/json":{"schema":{"type":"object","properties":{"customer_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/exports":{"get":{"summary":"List exports","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns CSV exports queued or completed for the current store. Polled by the admin SPA to detect when an export finishes (`done: true`).\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"exports found","content":{"application/json":{}}}}},"post":{"summary":"Create an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Queues a CSV export. The `type` selects the dataset; `search_params` is an\noptional Ransack query (same shape used by the `q[...]` params on list endpoints)\nthat filters which records are exported. Pass `record_selection: \"all\"` to\nclear the filter server-side and export everything in scope.\n\nGeneration is asynchronous. Poll `GET /admin/exports/{id}` until `done` is `true`,\nthen redirect the browser to `download_url` to fetch the file.\n\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"export queued","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["products","orders","customers","product_translations","gift_cards","coupon_codes","newsletter_subscribers"]},"record_selection":{"type":"string","enum":["filtered","all"],"description":"Set to \"all\" to ignore search_params and export everything in scope."},"search_params":{"type":"object","description":"Ransack query hash. Same predicates accepted by the list endpoint.","additionalProperties":true},"results_url":{"type":"string","description":"Absolute URL of your admin exports view; the export-done email uses it as the download button target. Only honored when it matches one of the store's configured allowed origins."}}}}}}}},"/api/v3/admin/exports/{id}":{"get":{"summary":"Show an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns export status. While `done` is `false`, the SPA continues polling.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"export found","content":{"application/json":{}}}}},"delete":{"summary":"Delete an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the export and purges its attachment.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"export deleted"}}}},"/api/v3/admin/exports/{id}/download":{"get":{"summary":"Download an export","tags":["Exports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the exported CSV with `Content-Disposition: attachment`. Returns 422 with `code: export_not_ready` while `done` is still `false`. The endpoint is JWT/API-key protected, so SPA clients must fetch it (with `Authorization` header) and trigger the browser download via a Blob URL — a top-level navigation cannot carry the JWT.\n\n**Required scope:** the read scope of the exported resource — `read_products` for product exports, `read_customers` for customer exports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments":{"get":{"summary":"List fulfillments","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all shipments for an order.\n\n**Required scope:** `read_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., inventory_units, stock_location, shipping_rates). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,status,tracking,cost). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillments found","content":{"application/json":{}}}}},"post":{"summary":"Create a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Manually creates a fulfillment on a completed order, bypassing order routing — for example to mirror a shipment handled by an external carrier or 3PL. Moves the requested line item quantities out of their current fulfillments; when `items` is omitted, every not-yet-shipped unit is moved. Pass `status: 'shipped'` to register an already-shipped fulfillment (fires shipped webhooks and freezes cost/carrier). When `delivery_method_id` is omitted, the fulfillment inherits the delivery method and cost of the source fulfillment(s) it fully drains — keeping the order total unchanged; partially drained splits get no carrier when shipped, and pending fulfillments are otherwise (re)priced by the standard rate engine, which selects the lowest-cost available rate. Pass `cost` to set an explicit shipping cost instead (e.g. the 3PL price) — note this changes the order total and payment state, and is guaranteed to persist only with `status: 'shipped'` (pending fulfillments are re-priced by the rate engine).\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"fulfillment created","content":{"application/json":{}}},"422":{"description":"order not completed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["stock_location_id"],"properties":{"stock_location_id":{"type":"string","description":"Stock location the fulfillment ships from"},"tracking":{"type":"string","description":"Carrier tracking number, or a full https:// tracking link — a full URL is served back as tracking_url unchanged instead of being templated into the delivery method tracking URL"},"delivery_method_id":{"type":"string","description":"Delivery method (carrier) to attach as the selected rate. Defaults to the delivery method of the fully drained source fulfillment(s)"},"cost":{"type":"string","description":"Explicit shipping cost. Defaults to the summed cost of the fully drained source fulfillment(s), which keeps the order total unchanged; an explicit cost changes the order total and payment state. Guaranteed to persist only with status: 'shipped' — pending fulfillments are re-priced by the rate engine"},"status":{"type":"string","enum":["shipped"],"description":"Pass 'shipped' to register the fulfillment as already shipped"},"items":{"type":"array","description":"Line item quantities to fulfill. Omit to fulfill every not-yet-shipped unit.","items":{"type":"object","required":["item_id","quantity"],"properties":{"item_id":{"type":"string","description":"Line item ID"},"quantity":{"type":"integer"}}}},"metadata":{"type":"object","additionalProperties":true}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}":{"get":{"summary":"Show a shipment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific shipment.\n\n**Required scope:** `read_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., inventory_units, stock_location, shipping_rates). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,status,tracking,cost). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"shipment found","content":{"application/json":{}}}}},"patch":{"summary":"Update a shipment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a fulfillment (tracking, delivery rate).\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"shipment updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tracking":{"type":"string","description":"Carrier tracking number, or a full https:// tracking link served back as tracking_url unchanged"},"selected_delivery_rate_id":{"type":"string","description":"Delivery rate ID (dr_...) to select"}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/fulfill":{"patch":{"summary":"Fulfill a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Marks a fulfillment as fulfilled.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment fulfilled","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/purchase_label":{"patch":{"summary":"Buy the shipping label","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Buys the shipping label for a parcel that has not shipped yet — print it, pack the box, then mark the fulfillment fulfilled. Only delivery methods whose provider produces labels accept this.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"label purchased","content":{"application/json":{}}},"422":{"description":"provider does not produce labels","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/mark_delivered":{"patch":{"summary":"Mark a fulfillment delivered","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Records that the customer received the goods. Only a fulfilled shipment can be marked delivered.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment delivered","content":{"application/json":{}}},"422":{"description":"fulfillment has not shipped","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"delivered_at":{"type":"string","format":"date-time","description":"When the goods arrived. Defaults to now."},"notify_customer":{"type":"boolean","description":"Whether the customer gets a delivery notification. Defaults to true."}}}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/cancel":{"patch":{"summary":"Cancel a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Cancels a fulfillment.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment canceled","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/resume":{"patch":{"summary":"Resume a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Resumes a canceled fulfillment.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment resumed","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/fulfillments/{id}/split":{"patch":{"summary":"Split a fulfillment","tags":["Fulfillments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Transfers items from this shipment to a new shipment at a different stock location.\n\n**Required scope:** `write_fulfillments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Fulfillment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"fulfillment split","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id","quantity"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"stock_location_id":{"type":"string","description":"Target stock location ID"}}}}}}}},"/api/v3/admin/gift_card_batches":{"get":{"summary":"List gift card batches","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the gift card batches issued by the current store. Each batch\ngroups the cards generated together for a campaign or bulk-issuance\n— the cards themselves live under `/admin/gift_cards` and reference\nthe batch via `gift_card_batch_id`.\n\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Records per page","schema":{"type":"integer"}},{"name":"q[prefix_cont]","in":"query","required":false,"description":"Filter by prefix (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift card batches found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GiftCardBatch"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a gift card batch","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a batch of gift cards in a single call. The server generates\n`codes_count` cards inline for small batches (configurable via\n`Spree.config.gift_card_batch_web_limit`, default 500) or enqueues\na background job for larger ones. Each card's code is the batch\n`prefix` followed by random hex.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"gift card batch created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCardBatch"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["prefix","amount","codes_count"],"properties":{"prefix":{"type":"string","description":"Lowercased and prepended to every generated code."},"amount":{"type":"string","description":"Decimal amount per card, greater than zero."},"currency":{"type":"string","description":"ISO 4217 currency code. Defaults to the store currency."},"codes_count":{"type":"integer","description":"Number of cards to generate. Capped at `gift_card_batch_limit`."},"expires_at":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/gift_card_batches/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Gift card batch prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a gift card batch","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single batch.\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"gift card batch found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCardBatch"}}}},"404":{"description":"gift card batch not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/gift_cards":{"get":{"summary":"List gift cards","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the gift cards issued by the current store. Filter by\n`q[code_cont]` for code search, `q[user_id_eq]` for cards issued\nto a specific customer, or `q[state_eq]` for status filtering.\n\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[code_cont]","in":"query","required":false,"description":"Filter by gift card code (contains)","schema":{"type":"string"}},{"name":"q[state_eq]","in":"query","required":false,"description":"Filter by status (active, redeemed, partially_redeemed, canceled)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift cards found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a gift card scoped to the current store. The code is\nauto-generated when omitted. `currency` defaults to the store's\nconfigured currency. Pass `user_id` (prefixed ID) to attach the\ncard to a specific customer.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"gift card created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["amount"],"properties":{"amount":{"type":"string","description":"Decimal amount, greater than zero."},"currency":{"type":"string","description":"ISO 4217 currency code. Defaults to the store currency."},"code":{"type":"string","description":"Optional caller-supplied code. Auto-generated when omitted."},"expires_at":{"type":"string","description":"ISO 8601 date.","nullable":true},"user_id":{"type":"string","description":"Optional customer prefixed ID.","nullable":true}}}}}}}},"/api/v3/admin/gift_cards/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Gift card prefixed ID","schema":{"type":"string"}}],"get":{"summary":"Get a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single gift card.\n\n**Required scope:** `read_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"gift card found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}},"404":{"description":"gift card not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an active gift card's editable attributes. Redeemed or\npartially-redeemed cards cannot be edited.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"gift card updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string"},"expires_at":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a gift card","tags":["Gift Cards"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an unused gift card. Cards that have been redeemed or\npartially redeemed cannot be deleted and return 422.\n\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"gift card deleted"},"422":{"description":"redeemed gift card cannot be deleted","content":{"application/json":{}}}}}},"/api/v3/admin/imports":{"get":{"summary":"List imports","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns CSV imports queued or completed for the current store.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"imports found","content":{"application/json":{}}}}},"post":{"summary":"Create an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Queues a CSV import. Upload the file first via `POST /api/v3/admin/direct_uploads`\nand pass the returned `signed_id` as `attachment`. On success the import is in the\n`mapping` state and the response carries the mapping payload: `schema_fields`\n(the canonical columns for the type), `csv_headers`, a `sample_row`, and the\nauto-assigned `mappings`.\n\nAdjust mappings if needed, then call `PATCH /admin/imports/{id}/complete_mapping`\nto start processing. Poll `GET /admin/imports/{id}` while `status` is\n`completed_mapping`/`processing`; terminal statuses are `completed` and `failed`.\n\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"import created in mapping state","content":{"application/json":{}}},"422":{"description":"unknown import type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["type","attachment"],"properties":{"type":{"type":"string","enum":["products","customers","product_translations"]},"attachment":{"type":"string","description":"ActiveStorage signed blob id from POST /api/v3/admin/direct_uploads."},"preferred_delimiter":{"type":"string","enum":[",",";","|","\t"],"description":"CSV column separator. Defaults to a comma."},"results_url":{"type":"string","description":"Absolute URL of your admin imports view; the import-done email links back to it with `?import=<id>` appended. Only honored when it matches one of the store's configured allowed origins."}}}}}}}},"/api/v3/admin/imports/template":{"get":{"summary":"Download an import template","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a CSV header row for the given import type, including the custom field columns available for the model.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"description":"Registered import type, e.g. products.","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV template","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/imports/example":{"get":{"summary":"Download an example import file","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Redirects to a populated example CSV for the given import type — the same sample data `rake spree:load_sample_data` uses, pinned to the installed Spree version. Returns 404 for a type that ships no example file.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"description":"Registered import type, e.g. products.","schema":{"type":"string"}}],"responses":{"302":{"description":"Redirect to the example CSV"}}}},"/api/v3/admin/imports/{id}":{"get":{"summary":"Show an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns import status and row counters. The admin dashboard polls this endpoint while `status` is `completed_mapping` or `processing`; `rows_count`, `completed_rows_count` and `failed_rows_count` drive the progress bar. The mapping payload (`csv_headers`, `sample_row`) is only present while `status` is `mapping`.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"import found","content":{"application/json":{}}}}},"delete":{"summary":"Delete an import","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the import, its rows and the uploaded file. Returns 422 while the import is being processed.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"import deleted"}}}},"/api/v3/admin/imports/{id}/download":{"get":{"summary":"Download the originally uploaded file","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the CSV exactly as it was uploaded — the audit trail for what was imported. JWT/API-key protected; SPA clients fetch it with the Authorization header and trigger the browser download via a Blob URL.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file","content":{"application/json":{},"text/csv":{"schema":{"type":"string","format":"binary"}}}}}}},"/api/v3/admin/imports/{id}/complete_mapping":{"patch":{"summary":"Complete mapping and start processing","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies the submitted column mappings, then starts row processing. Omit `mappings`\nto accept the auto-assigned ones from the create response. Returns 422 when a\nrequired schema field is left unmapped (`details.missing_required_fields`) or a\nfile column is assigned twice.\n\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"mapping completed, processing queued","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"mappings":{"type":"array","description":"Column assignments to apply before starting. `file_column: null` unmaps a field.","items":{"type":"object","required":["schema_field"],"properties":{"schema_field":{"type":"string"},"file_column":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/imports/{id}/retry_failed_rows":{"patch":{"summary":"Retry failed rows","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Re-processes the rows that failed. The import re-enters `processing`; poll `GET /admin/imports/{id}` until it completes again. Returns 422 when the import is not `completed` or has no failed rows.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"retry queued","content":{"application/json":{}}}}}},"/api/v3/admin/imports/{import_id}/rows":{"get":{"summary":"List import rows","tags":["Imports"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Paginated rows of an import — the failure report. Filter with `q[status_eq]=failed` to list only rows that could not be imported; each row carries the raw CSV `data` and its `validation_errors`.\n\n**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"import_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"description":"Filter rows by status: pending, processing, completed, failed.","schema":{"type":"string"}}],"responses":{"200":{"description":"rows found","content":{"application/json":{}}}}}},"/api/v3/admin/markets":{"get":{"summary":"List markets","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the markets configured for the current store. Markets are\nstore-scoped and ordered by `position` (an `acts_as_list` column —\nupdate the order via `PATCH /markets/{id}` with `position`).\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `countries`.","schema":{"type":"string"}}],"responses":{"200":{"description":"markets found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Market"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new market for the current store.\n\n- `country_codes` accepts 2-letter ISO country codes (e.g. `[\"DE\", \"FR\"]`);\n the market must contain at least one country. Unknown codes are\n silently dropped.\n- `supported_locales` accepts an array of locale codes; the\n `default_locale` is always implicitly included.\n- Setting `default: true` automatically demotes the previous default\n market in the store.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"market created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"currency":{"type":"string","description":"ISO 4217 currency code."},"default_locale":{"type":"string","description":"IETF locale tag used as the market default."},"supported_locales":{"type":"array","items":{"type":"string"},"description":"Locale codes available in this market. The default is always implicitly included."},"tax_inclusive":{"type":"boolean","default":false,"description":"Display prices with tax included."},"default":{"type":"boolean","default":false,"description":"Setting to true demotes the previous default."},"position":{"type":"integer","description":"Sort order within the store; lower = first."},"country_codes":{"type":"array","items":{"type":"string"},"description":"2-letter ISO country codes assigned to this market. At least one is required."}},"required":["name","currency","default_locale","country_codes"]}}}}}},"/api/v3/admin/markets/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"market found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"404":{"description":"market not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing market. Pass `country_codes` to replace the\nmarket's country list (full-set update), `supported_locales` to\nreplace the supported locales, or `position` to reorder the market\nwithin the store.\n\nSetting `default: true` automatically demotes the previous default.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"market updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Market"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"currency":{"type":"string"},"default_locale":{"type":"string"},"supported_locales":{"type":"array","items":{"type":"string"}},"tax_inclusive":{"type":"boolean"},"default":{"type":"boolean"},"position":{"type":"integer"},"country_codes":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a market","tags":["Markets"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the market (sets `deleted_at`). The default market and\nthe last remaining market in a store cannot be deleted — both return\n422 with a `validation_error`.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"market deleted"},"422":{"description":"cannot delete default or last market","content":{"application/json":{}}}}}},"/api/v3/admin/option_types":{"get":{"summary":"List option types","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of option types.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,label,position). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"option types found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OptionType"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new option type. Supports nested option values.\n\nOption values can be provided inline and will be created or updated by name.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"option type created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"},"filterable":{"type":"boolean"},"option_values":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"}}}}},"required":["name","label"]}}}}}},"/api/v3/admin/option_types/{id}":{"get":{"summary":"Get an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single option type by ID, including its option values.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,label,position). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"option type found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"404":{"description":"option type not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an option type. Supports updating nested option values.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}}],"responses":{"200":{"description":"option type updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptionType"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"},"filterable":{"type":"boolean"},"option_values":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Existing option value ID to update"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"integer"}}}}}}}}}},"delete":{"summary":"Delete an option type","tags":["Option Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes an option type.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Option type ID","schema":{"type":"string"}}],"responses":{"204":{"description":"option type deleted"}}}},"/api/v3/admin/orders/{order_id}/tax_lines":{"get":{"summary":"List tax lines","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Typed tax rows on the order. Read-only — written exclusively by the tax provider.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"200":{"description":"tax lines found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/discounts":{"get":{"summary":"List discounts","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Typed discount rows (promotion-sourced and manual) on the order.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"200":{"description":"discounts found","content":{"application/json":{}}}}},"post":{"summary":"Create manual discount","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a manual discount. With line_item_id a single row is created; without it the amount is distributed across line items (largest remainder). This is the sanctioned post-placement discount path and works on completed orders.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"201":{"description":"discount created","content":{"application/json":{}}},"422":{"description":"invalid discount","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"value":{"type":"number"},"value_type":{"type":"string","enum":["flat","percent"]},"line_item_id":{"type":"string","nullable":true,"description":"Target line item; omit to distribute order-level"}},"required":["label","value"]}}}}}},"/api/v3/admin/orders/{order_id}/fees":{"post":{"summary":"Create fee","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a fee (surcharge, handling, gift wrap, COD, payment fee). Order-level when no target is given. Works on completed orders.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order prefixed ID","schema":{"type":"string"}}],"responses":{"201":{"description":"fee created","content":{"application/json":{}}},"422":{"description":"invalid fee","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"number"},"kind":{"type":"string","enum":["surcharge","handling","gift_wrap","cod","payment"],"description":"Defaults to 'surcharge'"},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true}},"required":["label","amount"]}}}}}},"/api/v3/admin/orders/{order_id}/gift_cards":{"post":{"summary":"Apply a gift card to an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies a gift card by code to the order. Returns the gift card.\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"gift card applied","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["code"],"properties":{"code":{"type":"string","description":"Gift card code"}}}}}}}},"/api/v3/admin/orders/{order_id}/gift_cards/{id}":{"delete":{"summary":"Remove a gift card from an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the gift card from the order.\n\n**Required scope:** `write_gift_cards` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Gift card ID","schema":{"type":"string"}}],"responses":{"204":{"description":"gift card removed"}}}},"/api/v3/admin/orders/{order_id}/items":{"get":{"summary":"List order items","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all line items for an order.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variant, variant.product). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., quantity,price,total). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"items found","content":{"application/json":{}}}}},"post":{"summary":"Add an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new line item to the order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"item added","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id"],"properties":{"variant_id":{"type":"string","description":"Prefixed variant ID"},"quantity":{"type":"integer","default":1}}}}}}}},"/api/v3/admin/orders/{order_id}/items/{id}":{"get":{"summary":"Show an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific line item.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variant, variant.product). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., quantity,price,total). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"item found","content":{"application/json":{}}}}},"patch":{"summary":"Update an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an order item quantity or metadata.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}}],"responses":{"200":{"description":"item updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"integer"}}}}}}},"delete":{"summary":"Remove an item","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes an item from the order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Item ID","schema":{"type":"string"}}],"responses":{"204":{"description":"line item removed"}}}},"/api/v3/admin/orders/{order_id}/store_credits":{"post":{"summary":"Apply customer's store credit to an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Applies the order customer's available store credit. When `amount` is omitted, applies up to the order outstanding balance.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"store credit applied","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string","description":"Optional explicit amount; defaults to order outstanding balance"}}}}}}},"delete":{"summary":"Remove store credit from an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes any applied store credit from the order.\n\n**Required scope:** `write_store_credits` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"204":{"description":"store credit removed"}}}},"/api/v3/admin/orders":{"get":{"summary":"List orders","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of orders for the current store.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"sort","in":"query","required":false,"description":"Sort field (e.g., created_at, -created_at, completed_at)","schema":{"type":"string"}},{"name":"q[state_eq]","in":"query","required":false,"description":"Filter by state (cart, address, delivery, payment, confirm, complete, canceled)","schema":{"type":"string"}},{"name":"q[email_cont]","in":"query","required":false,"description":"Filter by email (contains)","schema":{"type":"string"}},{"name":"q[number_eq]","in":"query","required":false,"description":"Filter by order number","schema":{"type":"string"}},{"name":"q[completed_at_gt]","in":"query","required":false,"description":"Filter by completed after date","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., items, fulfillments, payments, customer, discounts, billing_address, shipping_address). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,total,status,completed_at). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"orders found","content":{"application/json":{}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a draft order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new draft order in one shot. Customer, items, addresses, currency,\nmarket, channel, locale, notes, metadata, and a coupon code can all be\nprovided inline.\n\nSetting `preferred_stock_location_id` pins the order's preferred fulfillment\nlocation — Order Routing's built-in `PreferredLocation` rule consumes it\nwhen picking which stock location ships each shipment.\n\nInvalid coupon codes are non-fatal — the order is created and the failure\nis reported on the service result (not in the API response body for now).\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"order created with preferred_stock_location_id","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"customer_id":{"type":"string","description":"Customer ID. Alias: user_id (legacy)."},"use_customer_default_address":{"type":"boolean","description":"When true with customer_id, copies the customer's saved billing/shipping addresses onto the order."},"currency":{"type":"string"},"market_id":{"type":"string","description":"Market ID"},"channel_id":{"type":"string","description":"Channel ID. Defaults to the store primary channel when omitted."},"preferred_stock_location_id":{"type":"string","description":"Stock Location ID to prefer for fulfillment. Order Routing's built-in PreferredLocation rule reads this and ranks the location first; routing falls back to the next rule when the preferred location can't cover the cart."},"locale":{"type":"string"},"customer_note":{"type":"string","description":"Public, customer-visible note"},"internal_note":{"type":"string","description":"Staff-only note"},"metadata":{"type":"object","description":"Arbitrary key/value metadata"},"shipping_address":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"shipping_address_id":{"type":"string","description":"Existing customer address ID"},"billing_address":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"billing_address_id":{"type":"string","description":"Existing customer address ID"},"items":{"type":"array","items":{"type":"object","required":["variant_id","quantity"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"metadata":{"type":"object"}}}},"coupon_code":{"type":"string","description":"Optional. Applied non-fatally; invalid codes do not block creation."}}}}}}}},"/api/v3/admin/orders/{id}":{"get":{"summary":"Show an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns full order details including admin-only fields.\n\n**Required scope:** `read_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID (e.g., or_xxx)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., items, fulfillments, payments, customer, discounts, billing_address, shipping_address). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., number,total,status,completed_at). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"order found","content":{"application/json":{}}},"404":{"description":"order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an order. Supports updating email, addresses, special instructions, and line items.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"customer_note":{"type":"string"},"internal_note":{"type":"string"},"channel_id":{"type":"string","description":"Channel ID"},"preferred_stock_location_id":{"type":"string","description":"Stock Location ID to prefer for fulfillment. Re-runs Order Routing's PreferredLocation rule on subsequent shipment rebuilds."},"ship_address":{"type":"object","properties":{"firstname":{"type":"string"},"lastname":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"zipcode":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"bill_address":{"type":"object","properties":{"firstname":{"type":"string"},"lastname":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"zipcode":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"},"phone":{"type":"string"}}},"items":{"type":"array","items":{"type":"object","required":["variant_id"],"properties":{"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer"},"metadata":{"type":"object"}}}}}}}}}},"delete":{"summary":"Delete a draft order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a draft order. Completed orders cannot be deleted.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"204":{"description":"order deleted"}}}},"/api/v3/admin/orders/{id}/complete":{"patch":{"summary":"Complete an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Completes an order in the `confirm` state, marking it as placed.\n\nSet `notify_customer: true` to send the order confirmation email.\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order completed","content":{"application/json":{}}},"422":{"description":"order cannot be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"notify_customer":{"type":"boolean","description":"Send the order confirmation email after completion."}}}}}}}},"/api/v3/admin/orders/{id}/cancel":{"patch":{"summary":"Cancel an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Cancels a completed order.\n\nSet `notify_customer: true` to send the order cancellation email.\n\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order canceled","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"notify_customer":{"type":"boolean","description":"Send the order cancellation email after canceling."}}}}}}}},"/api/v3/admin/orders/{id}/approve":{"patch":{"summary":"Approve an order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Approves an order (e.g., for fraud review).\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order approved","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{id}/resume":{"patch":{"summary":"Resume a canceled order","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Resumes a previously canceled order.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"order resumed","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{id}/resend_confirmation":{"post":{"summary":"Resend confirmation email","tags":["Orders"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes the order.completed event to trigger confirmation email delivery.\n\n**Required scope:** `write_orders` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"confirmation resent","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods":{"get":{"summary":"List payment methods","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's configured payment methods. Use `source_required: true` to know which methods need a saved source.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,type,active). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment methods found","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods/types":{"get":{"summary":"List available payment provider types","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PaymentMethod subclasses that can be used to create new payment methods. Useful for populating a \"Provider\" dropdown in admin UIs.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"provider types found","content":{"application/json":{}}}}}},"/api/v3/admin/payment_methods/{id}":{"get":{"summary":"Show a payment method","tags":["Payment Methods"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a payment method by ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand. Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,type,active). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment method found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/payments":{"get":{"summary":"List payments","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all payments for an order.\n\n**Required scope:** `read_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method, source). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,status,number,response_code). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payments found","content":{"application/json":{}}}}},"post":{"summary":"Create a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new payment for the order.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"payment created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["payment_method_id"],"properties":{"payment_method_id":{"type":"string","description":"Payment method ID"},"amount":{"type":"string"},"source_id":{"type":"string","description":"Payment source ID"}}}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}":{"get":{"summary":"Show a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns details of a specific payment.\n\n**Required scope:** `read_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment_method, source). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,status,number,response_code). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"payment found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}/capture":{"patch":{"summary":"Capture a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Captures a pending payment.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"payment captured","content":{"application/json":{}}},"422":{"description":"capture failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/orders/{order_id}/payments/{id}/void":{"patch":{"summary":"Void a payment","tags":["Payments"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Voids a payment.\n\n**Required scope:** `write_payments` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Payment ID","schema":{"type":"string"}}],"responses":{"200":{"description":"payment voided","content":{"application/json":{}}}}}},"/api/v3/admin/price_lists":{"get":{"summary":"List price lists","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the price lists configured for the current store.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `price_rules`.","schema":{"type":"string"}}],"responses":{"200":{"description":"price lists found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PriceList"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new draft price list.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"price list created (server-to-server — rules + prices, no product_ids)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer"},"product_ids":{"type":"array","items":{"type":"string"},"description":"Prefixed product ids to seed the list with."},"rules":{"type":"array","description":"STI-typed price rules to attach on create. Existing rules on the same payload via PATCH reconcile by id.","items":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"prices":{"type":"array","description":"Server-to-server alternative to `product_ids`: ship the exact per-variant prices the list should contain. Each row upserts on the unique key `(variant_id, currency, price_list_id)`. Mix-and-match with `product_ids` is supported but typically unnecessary — `prices` alone tells the server which variants belong to the list and what the override amount is.","items":{"type":"object","required":["variant_id","currency"],"properties":{"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/price_lists/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"404":{"description":"price list not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a price list. The optional `rules:` array reconciles nested\nSTI-typed price rules in a single round-trip — existing rules update\nby `id`, new rules build, missing rules destroy. Mirrors the\npromotion editor's \"save the whole thing on Save\" pattern.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list updated with nested rules","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer"},"product_ids":{"type":"array","items":{"type":"string"},"description":"Prefixed product ids — reconciles list membership (adds + removes)."},"rules":{"type":"array","items":{"type":"object","required":["type"],"properties":{"id":{"type":"string","nullable":true},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"prices":{"type":"array","description":"Individual price overrides (the spreadsheet payload). Each row updates by `id` if shipped, otherwise upserts on the unique key `(variant_id, currency, price_list_id)`.","items":{"type":"object","oneOf":[{"required":["id"]},{"required":["variant_id","currency"]}],"properties":{"id":{"type":"string"},"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}},"delete":{"summary":"Delete a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the price list. Associated prices are removed asynchronously.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"price list deleted"}}}},"/api/v3/admin/price_lists/{id}/activate":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Activate a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Transitions a draft / inactive list to `active`. If `starts_at` is\nin the future the list is marked `scheduled` instead, matching the\nlegacy admin behaviour.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list activated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}}}},"/api/v3/admin/price_lists/{id}/deactivate":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Deactivate a price list","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price list deactivated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}}}}},"/api/v3/admin/prices":{"get":{"summary":"List prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Generic prices endpoint covering both base prices and price-list\noverrides. Filter with Ransack: `q[price_list_id_eq]=…`,\n`q[currency_eq]=USD`, `q[price_list_id_null]=true` (base prices only).\n\nThe admin spreadsheet uses this with server-side pagination so it\nscales past the metadata-PATCH path on `/price_lists/:id`.\n\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"q[price_list_id_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[price_list_id_null]","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"q[currency_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"q[variant_id_eq]","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Comma-separated sort keys. Supports e.g. `variant_product_name,variant_id`.","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed. Supported: `variant`.","schema":{"type":"string"}}],"responses":{"200":{"description":"prices found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Price"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a single price. Omit `price_list_id` to create a base price.\nFor more than a handful of rows, prefer `POST /admin/prices/bulk_upsert`.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"price created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["variant_id","currency"],"properties":{"variant_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"price_list_id":{"type":"string","nullable":true}}}}}}}},"/api/v3/admin/prices/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}},"404":{"description":"price not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"price updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Price"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a price","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the price (acts_as_paranoid).\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"price deleted"}}}},"/api/v3/admin/prices/bulk_upsert":{"post":{"summary":"Bulk-upsert prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Upserts a batch of prices in a single SQL round trip.\n\nEach row either:\n* targets an existing price by `id`, OR\n* matches on the unique key `(variant_id, currency, price_list_id)` —\n updating the existing row if one exists, creating one otherwise.\n\nModel callbacks (e.g. PriceHistory) are bypassed; this is a\nbulk-write fast path for the admin spreadsheet. The response\ncarries `price_count` — the number of rows touched.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"prices upserted","content":{"application/json":{"schema":{"type":"object","properties":{"price_count":{"type":"integer"}}}}}},"422":{"description":"missing prices key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["prices"],"properties":{"prices":{"type":"array","items":{"type":"object","required":["variant_id","currency"],"properties":{"id":{"type":"string","nullable":true},"variant_id":{"type":"string"},"currency":{"type":"string"},"price_list_id":{"type":"string","nullable":true},"amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true}}}}}}}}}}},"/api/v3/admin/prices/bulk_destroy":{"delete":{"summary":"Bulk-delete prices","tags":["Pricing"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes each price in `ids`. Returns the count actually destroyed.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"prices deleted","content":{"application/json":{"schema":{"type":"object","properties":{"price_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/{product_id}/custom_fields":{"get":{"summary":"List product custom fields","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the product's custom field values.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., custom_field_definition). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,value,namespace). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"custom fields found","content":{"application/json":{}}}}},"post":{"summary":"Create a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sets a custom field value on the product. Requires an existing CustomFieldDefinition; pass its prefixed `cfdef_…` id.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"custom field created","content":{"application/json":{}}},"422":{"description":"duplicate definition for the same product","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["custom_field_definition_id","value"],"properties":{"custom_field_definition_id":{"type":"string","description":"Prefixed `cfdef_…` id"},"value":{"description":"Value matching the definition's `field_type`"}}}}}}}},"/api/v3/admin/products/{product_id}/custom_fields/{id}":{"get":{"summary":"Show a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., custom_field_definition). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., key,value,namespace). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"custom field found","content":{"application/json":{}}}}},"patch":{"summary":"Update a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates the custom field's `value`. The linked definition cannot be changed — delete and recreate to switch.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"custom field updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["value"],"properties":{"value":{"description":"New value"}}}}}}},"delete":{"summary":"Delete a product custom field","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"custom field deleted"}}}},"/api/v3/admin/products/{product_id}/translations":{"get":{"summary":"List product translations","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the full translation matrix for the product: the source value and content type per translatable field, plus the translated value for every supported locale.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translations found","content":{"application/json":{}}}}}},"/api/v3/admin/products":{"get":{"summary":"List products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of products for the current store.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"sort","in":"query","required":false,"description":"Sort field (e.g., name, -name, price, -price, best_selling)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variants, media, option_types, categories). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,slug,price,status). id is always included.","schema":{"type":"string"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[status_eq]","in":"query","required":false,"description":"Filter by status","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new product. Supports nested variants with prices and option types.\n\nOption types and values are auto-created if they don't exist.\nPrices are upserted by currency. Stock items are upserted by stock location.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"product created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["draft","active","archived"]},"tax_category_id":{"type":"string","description":"Tax category ID"},"category_ids":{"type":"array","items":{"type":"string"},"description":"Array of category IDs"},"tags":{"type":"array","items":{"type":"string"}},"prices":{"type":"array","description":"Shorthand for a simple (no-options) product: per-currency prices that forward to the product's sole variant. For products with options, set prices per variant under `variants:` instead.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"variants":{"type":"array","description":"Array of variant payloads. Variants can declare multiple option pairs via `options:` and per-currency prices via `prices:`. Stock counts go in `stock_items:` (per stock location).","items":{"type":"object","properties":{"sku":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}},"required":["name"]}}}}}},"/api/v3/admin/products/{id}":{"get":{"summary":"Get a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single product by ID.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID (e.g., prod_xxx)","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., variants, media, option_types, categories). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., name,slug,price,status). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"product found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"404":{"description":"product not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a product. Only provided fields are updated.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"200":{"description":"product updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["draft","active","archived"]},"tax_category_id":{"type":"string","description":"Tax category ID"},"category_ids":{"type":"array","items":{"type":"string"},"description":"Array of category IDs"},"tags":{"type":"array","items":{"type":"string"}},"prices":{"type":"array","description":"Shorthand for a simple (no-options) product: per-currency prices that forward to the product's sole variant. For products with options, set prices per variant under `variants:` instead.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"variants":{"type":"array","description":"Array of variant payloads. Variants can declare multiple option pairs via `options:` and per-currency prices via `prices:`. Stock counts go in `stock_items:` (per stock location).","items":{"type":"object","properties":{"sku":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}}}}},"delete":{"summary":"Delete a product","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes a product.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product deleted"},"422":{"description":"deletion refused by a store rule","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/products/bulk_status_update":{"post":{"summary":"Bulk-update product status","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Sets `status` on each product in `ids`. Reindexes the affected products\nfor search. Cross-store IDs are silently dropped. Returns counts.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"cross-store products silently dropped","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"status":{"type":"string"}}}}}},"422":{"description":"invalid status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","status"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["draft","active","archived"]}}}}}}}},"/api/v3/admin/products/bulk_add_to_categories":{"post":{"summary":"Bulk-add products to categories","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each product in `ids` to every category (category) in `category_ids`.\nCategories from sibling stores are silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products added to categories","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"category_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","category_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_categories":{"post":{"summary":"Bulk-remove products from categories","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each product in `ids` from every category in `category_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products removed from categories","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","category_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_to_collections":{"post":{"summary":"Bulk-add products to collections","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Attaches each product in `ids` to every manual collection in `collection_ids`.\nAutomatic (rule-based) and sibling-store collections are silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products added to collections","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"collection_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","collection_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"collection_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_collections":{"post":{"summary":"Bulk-remove products from collections","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Detaches each product in `ids` from every collection in `collection_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products removed from collections","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","collection_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"collection_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_to_channels":{"post":{"summary":"Bulk-add products to channels","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Publishes each product in `ids` on every channel in `channel_ids`. Idempotent —\nre-publishing on an existing channel is a no-op. Channels from sibling stores\nare silently ignored.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products published on channels","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"channel_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","channel_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"channel_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_from_channels":{"post":{"summary":"Bulk-remove products from channels","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Unpublishes each product in `ids` from every channel in `channel_ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products unpublished from channels","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"channel_count":{"type":"integer"},"removed":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","channel_ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"channel_ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_add_tags":{"post":{"summary":"Bulk-add tags to products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds each tag name in `tags` to every product in `ids`. Tags are upserted by name.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags added","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"},"tag_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_remove_tags":{"post":{"summary":"Bulk-remove tags from products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes each tag in `tags` from every product in `ids`.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"tags removed","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","tags"],"properties":{"ids":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/products/bulk_destroy":{"delete":{"summary":"Bulk-delete products","tags":["Products"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes each product in `ids`. Returns the count actually destroyed.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"products deleted","content":{"application/json":{"schema":{"type":"object","properties":{"product_count":{"type":"integer"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/promotions/{promotion_id}/coupon_codes":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List coupon codes for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the auto-generated coupon codes for a multi-code promotion. Single-code promotions store the code on the promotion itself; this endpoint returns an empty list for them.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"coupon codes found","content":{"application/json":{}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_actions":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List actions for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"actions found","content":{"application/json":{}}}}},"post":{"summary":"Create an action on a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new action to a promotion. The `type` is the wire shorthand from `GET /promotion_actions/types` (e.g. `free_shipping`, `create_item_adjustments`). Fully-qualified Ruby class names are also accepted for backward compatibility.\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"action created","content":{"application/json":{}}},"422":{"description":"unknown action type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_actions/{id}":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"delete":{"summary":"Delete an action from a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"action deleted"}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_rules":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List rules for a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules found","content":{"application/json":{}}}}},"post":{"summary":"Create a rule on a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Adds a new rule to a promotion. The `type` is the wire shorthand from `GET /promotion_rules/types` (e.g. `currency`, `item_total`, `product`). Fully-qualified Ruby class names are also accepted for backward compatibility.\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"rule created with preferences","content":{"application/json":{}}},"422":{"description":"unknown rule type","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}},"required":["type"]}}}}}},"/api/v3/admin/promotions/{promotion_id}/promotion_rules/{id}":{"parameters":[{"name":"promotion_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a rule's preferences","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"preferences":{"type":"object","additionalProperties":true}}}}}}},"delete":{"summary":"Delete a rule from a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"rule deleted"}}}},"/api/v3/admin/promotions":{"get":{"summary":"List promotions","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's promotions, including manual coupon and automatic promotions.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"promotions found","content":{"application/json":{}}}}},"post":{"summary":"Create a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new promotion. `code` is required for single-code coupon promotions;\npass `multi_codes: true` with `number_of_codes` to auto-generate a batch.\n\nRules and actions can be created in the same request by passing arrays of\n`{ type, preferences, ... }` rows. The server reconciles to the desired set:\nnew rows are built, existing rows (by `id`) are updated, omitted rows are removed.\n\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"promotion created with rules and actions","content":{"application/json":{}}},"422":{"description":"invalid params","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"code":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"starts_at":{"type":"string","format":"date-time","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"usage_limit":{"type":"integer","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"kind":{"type":"string","enum":["coupon_code","automatic"]},"multi_codes":{"type":"boolean"},"number_of_codes":{"type":"integer","nullable":true},"code_prefix":{"type":"string","nullable":true},"promotion_category_id":{"type":"string","nullable":true},"rules":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"product_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"customer_ids":{"type":"array","items":{"type":"string"}}},"required":["type"]}},"actions":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"calculator":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"required":["type"]}}},"required":["name"]}}}}}},"/api/v3/admin/promotions/{id}":{"get":{"summary":"Show a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"promotion found","content":{"application/json":{}}}}},"patch":{"summary":"Update a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a promotion. The `rules` and `actions` arrays are treated as\na *desired set* — rows with `id` update in place, rows without `id` are\nbuilt fresh, and any existing row not present in the array is destroyed.\nPass `rules: []` or `actions: []` to clear them.\n\n\n**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rules and actions cleared with empty arrays","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"starts_at":{"type":"string","format":"date-time","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"usage_limit":{"type":"integer","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"kind":{"type":"string","enum":["coupon_code","automatic"]},"promotion_category_id":{"type":"string","nullable":true},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true,"description":"Pass to update an existing rule; omit to build a new one"},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"product_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"customer_ids":{"type":"array","items":{"type":"string"}}},"required":["type"]}},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"calculator":{"type":"object","properties":{"type":{"type":"string"},"preferences":{"type":"object","additionalProperties":true}}}},"required":["type"]}}}}}}}},"delete":{"summary":"Delete a promotion","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"promotion deleted"}}}},"/api/v3/admin/promotion_actions/types":{"get":{"summary":"List available promotion action types","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PromotionAction subclasses with their preference schemas. Used by admin UIs to populate the \"Add action\" picker and render generic preference forms.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"action types found","content":{"application/json":{}}}}}},"/api/v3/admin/promotion_rules/types":{"get":{"summary":"List available promotion rule types","tags":["Promotions"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the registered Spree::PromotionRule subclasses with their preference schemas.\n\n**Required scope:** `read_promotions` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"rule types found","content":{"application/json":{}}}}}},"/api/v3/admin/orders/{order_id}/refunds":{"get":{"summary":"List refunds","tags":["Refunds"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all refunds for an order.\n\n**Required scope:** `read_refunds` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., payment, refund_reason). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., amount,reason,transaction_id). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"refunds found","content":{"application/json":{}}}}},"post":{"summary":"Create a refund","tags":["Refunds"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a refund for a payment on the order. The refund is automatically processed via the payment gateway.\n\n**Required scope:** `write_refunds` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"order_id","in":"path","required":true,"description":"Order ID","schema":{"type":"string"}}],"responses":{"201":{"description":"refund created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["payment_id","amount"],"properties":{"payment_id":{"type":"string","description":"Payment ID"},"amount":{"type":"string"},"refund_reason_id":{"type":"string","description":"Refund reason ID"}}}}}}}},"/api/v3/admin/locales":{"get":{"summary":"List supported locales","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the locales a merchant can translate content into for the current store, with the default and right-to-left flags.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"locales found","content":{"application/json":{}}}}}},"/api/v3/admin/store_credit_categories":{"get":{"summary":"List store credit categories","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the configured store credit categories. Categories classify\nstore credits (e.g., \"Goodwill\", \"Gift Card\", \"Refund\") and surface\nin the admin UI as a dropdown when issuing or editing a store\ncredit. Category names matching `Spree::Config[:non_expiring_credit_types]`\nare flagged via `non_expiring: true`.\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credit categories found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StoreCreditCategory"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/store_credit_categories/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Store credit category ID","schema":{"type":"string"}}],"get":{"summary":"Get a store credit category","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single store credit category by prefixed ID.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"store credit category found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoreCreditCategory"}}}},"404":{"description":"store credit category not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/store":{"get":{"summary":"Get the current store","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the current store configuration. The store is resolved from the request context (host or admin selection); there is no `id` parameter.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"current store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Store"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update the current store","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates the current store configuration.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"store updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Store"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"preferred_admin_locale":{"type":"string"},"preferred_timezone":{"type":"string"},"preferred_weight_unit":{"type":"string"},"preferred_unit_system":{"type":"string"}}}}}}}},"/api/v3/admin/tags":{"get":{"summary":"List tags","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns tag names for a given taggable type. Used for autocomplete in tag inputs on products, orders, and customers.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"taggable_type","in":"query","required":true,"description":"Taggable type (`Spree::Product`, `Spree::Order`, or `Spree::User`)","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Optional case-insensitive substring filter","schema":{"type":"string"}}],"responses":{"200":{"description":"tags found","content":{"application/json":{}}},"422":{"description":"invalid taggable type","content":{"application/json":{}}}}}},"/api/v3/admin/tax_rates":{"get":{"summary":"List tax rates","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the store's tax rates. Rates are the entire configuration of\nthe built-in tax provider: each pairs a tax category with a jurisdiction\n(a country, optionally narrowed to one state) and a percentage, and\ndecides whether the tax is already included in the product price\n(VAT-style) or added on top (US-style).\n\nMarkets using an external tax provider ignore these rows — that\nprovider carries its own jurisdiction data.\n\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[included_in_price_true]","in":"query","required":false,"description":"Only rates included in the product price","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rates found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TaxRate"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a tax rate for the current store. Give either `amount` as a\ndecimal (`0.19`) or `amount_percentage` as a percentage (`19`).\n\nName the jurisdiction with `country_code` (and `state_code` for a\nstate-level rate). Omitting the country makes the rate apply everywhere.\n\nSet `included_in_price` for VAT-style pricing, where the rate is backed\nout of the displayed price rather than added to it.\n\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"tax rate created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}},"422":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Customer-facing rate name, e.g. \"VAT\""},"amount":{"type":"string","description":"Rate as a decimal, e.g. \"0.19\""},"amount_percentage":{"type":"number","description":"Rate as a percentage, e.g. 19"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"tax_category_id":{"type":"string"},"country_code":{"type":"string","description":"ISO code, e.g. \"DE\". Omit for every country."},"state_code":{"type":"string","description":"State abbreviation within that country, e.g. \"CA\"."}},"required":["name","tax_category_id"]}}},"required":true}}},"/api/v3/admin/tax_rates/{id}":{"parameters":[{"name":"id","in":"path","description":"Tax rate ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rate found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}}}},"patch":{"summary":"Update a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"tax rate updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxRate"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"amount":{"type":"string"},"amount_percentage":{"type":"number"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"tax_category_id":{"type":"string"},"country_code":{"type":"string"},"state_code":{"type":"string"}}}}},"required":true}},"delete":{"summary":"Delete a tax rate","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the rate. Tax lines it already produced keep their own rate snapshot.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"tax rate deleted"}}}},"/api/v3/admin/translatable_resources":{"get":{"summary":"List translatable resources","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns every translatable resource type and its translatable fields (key + content type), so clients can render translation editors generically.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translatable resources found","content":{"application/json":{}}}}}},"/api/v3/admin/translations/batch":{"post":{"summary":"Batch upsert translations","tags":["Settings"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Atomically upserts translations across many records of (possibly) different translatable resource types in one request — e.g. an option type and all its option values in one save. A flat list of independent registry writes; all entries succeed or none do.\n\n**Required scope:** `write_<resource>` for every resource type in the batch (for API-key authentication) (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"translations upserted","content":{"application/json":{}}},"422":{"description":"unsupported locale rolls back the whole batch","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["translations"],"properties":{"translations":{"type":"array","items":{"type":"object","required":["resource_type","resource_id","values"],"properties":{"resource_type":{"type":"string","description":"Translatable resource type token, e.g. `option_type`"},"resource_id":{"type":"string","description":"Prefixed id of the record"},"values":{"type":"object","description":"Map of locale code to { field: value }","additionalProperties":{"type":"object","additionalProperties":true}}}}}}}}}}}},"/api/v3/admin/admin_users":{"get":{"summary":"List staff","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns admin users with at least one role assignment on the current store.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff found","content":{"application/json":{}}}}}},"/api/v3/admin/admin_users/{id}":{"get":{"summary":"Show a staff member","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff member found","content":{"application/json":{}}}}},"patch":{"summary":"Update a staff member","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name fields and reassigns roles for the current store. `role_ids` is a complete replacement — roles not in the array are removed for this store.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"staff member updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"role_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Remove a staff member from this store","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the user's role assignments on the current store. The account is preserved — the user keeps access to any other stores.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"staff removed from store"}}}},"/api/v3/admin/invitations":{"get":{"summary":"List invitations","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns invitations for the current store, including pending and accepted.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"invitations found","content":{"application/json":{}}}}},"post":{"summary":"Create an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Invites a teammate by email. The invitation is scoped to the current store and carries the chosen role; on accept, a `RoleUser` is created via the invitation's `after_accept` callback.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"invitation created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email","role_id"],"properties":{"email":{"type":"string"},"role_id":{"type":"string"}}}}}}}},"/api/v3/admin/invitations/{id}":{"delete":{"summary":"Revoke an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"invitation revoked"}}}},"/api/v3/admin/invitations/{id}/resend":{"patch":{"summary":"Resend an invitation","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Issues a fresh token and dispatches the invitation email again.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"invitation resent","content":{"application/json":{}}}}}},"/api/v3/admin/permissions":{"get":{"summary":"List the permission catalog","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the permission catalog — the grant vocabulary shared by staff role permissions and secret API key scopes. Entries are grouped for permission pickers; labels and descriptions are localized. Readable by any authenticated admin credential.","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"catalog returned","content":{"application/json":{}}}}}},"/api/v3/admin/roles":{"get":{"summary":"List roles","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns staff roles with their catalog permissions. Roles are global, not per-store; `mutable: false` marks the protected admin role and host-locked rows.\n\n**Required scope:** `read_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"roles found","content":{"application/json":{}}}}},"post":{"summary":"Create a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a staff role. `permissions` holds catalog keys (see GET /admin/permissions); a caller may only grant keys they effectively hold.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"role created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"permissions":{"type":"array","items":{"type":"string"}}},"required":["name"]}}}}}},"/api/v3/admin/roles/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a role name, description or permissions. The admin role and host-locked roles (`mutable: false`) reject changes.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"role updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"permissions":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a role","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a role. Fails with 422 while the role is protected or still referenced by staff members or pending invitations.\n\n**Required scope:** `write_staff` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"role deleted"},"422":{"description":"role cannot be deleted","content":{"application/json":{}}}}}},"/api/v3/admin/stock_locations":{"get":{"summary":"List stock locations","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the configured stock locations. Stock locations are global\n(shared across stores). Filter with Ransack predicates such as\n`q[active_eq]`, `q[kind_eq]`, `q[pickup_enabled_eq]`, or\n`q[name_cont]`.\n\nPickup-related attributes (`kind`, `pickup_enabled`,\n`pickup_stock_policy`, `pickup_ready_in_minutes`,\n`pickup_instructions`) drive merchant pickup support at checkout —\ncustomers can collect orders from any active location with\n`pickup_enabled: true`.\n\n\n**Required scope:** `read_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[active_eq]","in":"query","required":false,"description":"Filter by active status","schema":{"type":"boolean"}},{"name":"q[kind_eq]","in":"query","required":false,"description":"Filter by kind (built-in: 'warehouse', 'store', 'fulfillment_center')","schema":{"type":"string"}},{"name":"q[pickup_enabled_eq]","in":"query","required":false,"description":"Filter by pickup-enabled flag","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"stock locations found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StockLocation"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new stock location.\n\nSetting `default: true` automatically demotes the previous default\nlocation.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"stock location created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true,"description":"Internal name shown only in the admin"},"active":{"type":"boolean"},"default":{"type":"boolean","description":"Setting to true demotes the previous default."},"kind":{"type":"string","enum":["warehouse","store","fulfillment_center"],"description":"Categorizes the location."},"propagate_all_variants":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true,"description":"ISO-3166 alpha-2 country code (e.g. \"US\")."},"state_code":{"type":"string","nullable":true,"description":"State / province abbreviation (e.g. \"NY\"). Resolved against the selected country."},"state_name":{"type":"string","nullable":true,"description":"Free-text state for countries without a states list."},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string","enum":["local","any"],"description":"'local' = items at this location only; 'any' = transfer-eligible (ship-to-store)."},"pickup_ready_in_minutes":{"type":"number","nullable":true,"minimum":0},"pickup_instructions":{"type":"string","nullable":true}},"required":["name"]}}}}}},"/api/v3/admin/stock_locations/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Stock location ID","schema":{"type":"string"}}],"get":{"summary":"Get a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single stock location by prefixed ID.\n\n**Required scope:** `read_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"stock location found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"404":{"description":"stock location not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates an existing stock location. Same address-field conventions as\nthe create endpoint.\n\nSetting `default: true` automatically demotes the previous default.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"stock location updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLocation"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true},"active":{"type":"boolean"},"default":{"type":"boolean"},"kind":{"type":"string","enum":["warehouse","store","fulfillment_center"]},"propagate_all_variants":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string","enum":["local","any"]},"pickup_ready_in_minutes":{"type":"number","nullable":true,"minimum":0},"pickup_instructions":{"type":"string","nullable":true}}}}}}},"delete":{"summary":"Delete a stock location","tags":["Stock Locations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the stock location (sets `deleted_at`). Existing\nfulfillments that referenced it keep the historical record via\n`Spree::StockLocation.with_deleted`.\n\n\n**Required scope:** `write_stock` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"stock location deleted"}}}},"/api/v3/admin/products/{product_id}/variants":{"get":{"summary":"List product variants","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of variants for a product, including the default variant.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., images, prices, stock_items, option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., sku,price,stock). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"variants found","content":{"application/json":{}}}}},"post":{"summary":"Create a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new variant for a product. Supports nested prices and stock items.\n\nOption types and values are auto-created if they don't exist.\nPrices are upserted by currency. Stock items are upserted by stock location.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"201":{"description":"variant created","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string"},"cost_price":{"type":"string"},"cost_currency":{"type":"string"},"weight":{"type":"number"},"height":{"type":"number"},"width":{"type":"number"},"depth":{"type":"number"},"weight_unit":{"type":"string"},"dimensions_unit":{"type":"string"},"track_inventory":{"type":"boolean"},"tax_category_id":{"type":"string"},"options":{"type":"array","description":"A variant on a product with option types should declare its option pairs (e.g. size + color) — one per option type it participates in. Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"position":{"type":"integer"},"barcode":{"type":"string"},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}}},"/api/v3/admin/products/{product_id}/variants/{id}":{"get":{"summary":"Get a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single variant by ID.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., images, prices, stock_items, option_values). Use dot notation for nested expand (max 4 levels).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include (e.g., sku,price,stock). id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"variant found","content":{"application/json":{}}},"404":{"description":"variant not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a variant. Only provided fields are updated.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}}],"responses":{"200":{"description":"variant updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string"},"cost_price":{"type":"string"},"cost_currency":{"type":"string"},"weight":{"type":"number"},"height":{"type":"number"},"width":{"type":"number"},"depth":{"type":"number"},"weight_unit":{"type":"string"},"dimensions_unit":{"type":"string"},"track_inventory":{"type":"boolean"},"tax_category_id":{"type":"string"},"options":{"type":"array","description":"One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"position":{"type":"integer"},"barcode":{"type":"string"},"prices":{"type":"array","description":"Per-currency prices. Upserted by currency.","items":{"type":"object","required":["currency","amount"],"properties":{"currency":{"type":"string"},"amount":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true}}}},"stock_items":{"type":"array","description":"Per-stock-location inventory. Upserted by stock_location_id.","items":{"type":"object","required":["stock_location_id","count_on_hand"],"properties":{"stock_location_id":{"type":"string","description":"Stock location ID (e.g. sloc_xxx)"},"count_on_hand":{"type":"integer"},"backorderable":{"type":"boolean"}}}}}}}}}},"delete":{"summary":"Delete a variant","tags":["Variants"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes a variant.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"product_id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Variant ID","schema":{"type":"string"}}],"responses":{"204":{"description":"variant deleted"}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}}],"get":{"summary":"List webhook deliveries","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns delivery attempts for the given endpoint, most recent first.\nEach row carries the original request payload, the response code\n(when the receiver replied), the execution time, and any transport\nerror — everything needed to audit failures and decide whether to\nredeliver.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[event_name_eq]","in":"query","required":false,"description":"Filter by event name (exact)","schema":{"type":"string"}},{"name":"q[success_eq]","in":"query","required":false,"description":"Filter by success flag","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-delivered_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"deliveries found","content":{"application/json":{}}},"404":{"description":"parent webhook endpoint not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries/{id}":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Webhook delivery ID","schema":{"type":"string"}}],"get":{"summary":"Get a webhook delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single delivery attempt with the full request payload and\nthe response body the receiver returned. Use this for ad-hoc debug\nof failed deliveries.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"delivery found","content":{"application/json":{}}},"404":{"description":"delivery not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v3/admin/webhook_endpoints/{webhook_endpoint_id}/deliveries/{id}/redeliver":{"parameters":[{"name":"webhook_endpoint_id","in":"path","required":true,"description":"Parent webhook endpoint ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Webhook delivery ID to redeliver","schema":{"type":"string"}}],"post":{"summary":"Redeliver a webhook delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new delivery row with the same payload + event_name and\nqueues it. The original row is preserved for audit history.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"redelivery queued","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints":{"get":{"summary":"List webhook endpoints","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns outbound webhook subscriptions for the current store. Each\nendpoint receives a signed POST when any subscribed event fires.\n`secret_key` is `null` on list reads — the plaintext is delivered\nexactly once on create.\n\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"q[name_cont]","in":"query","required":false,"description":"Filter by name (contains)","schema":{"type":"string"}},{"name":"q[url_cont]","in":"query","required":false,"description":"Filter by URL (contains)","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoints found","content":{"application/json":{}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a new outbound webhook subscription. The plaintext\n`secret_key` is returned **once** in this response — persist it\nimmediately to verify incoming webhook signatures. Subsequent reads\nreturn `null` for the secret. Pass an empty `subscriptions` array or\nomit it to receive every event.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"webhook endpoint created — secret_key returned once","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"name":{"type":"string"},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}}}}}}}}},"/api/v3/admin/webhook_endpoints/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"get":{"summary":"Get a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single webhook endpoint by prefixed ID.\n\n**Required scope:** `read_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"fields","in":"query","required":false,"description":"Comma-separated list of fields to include. id is always included.","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint found","content":{"application/json":{}}},"404":{"description":"webhook endpoint not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates name, URL, active flag, or the event subscription list.\nToggling `active` here is equivalent to calling `disable`/`enable`\nwithout an audit reason.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint updated","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Soft-deletes the endpoint and stops future deliveries.\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"webhook endpoint deleted"}}}},"/api/v3/admin/webhook_endpoints/{id}/send_test":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"post":{"summary":"Send a test delivery","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a `webhook.test` delivery record and queues it. Use this to\nverify the endpoint is reachable and your signature verification\naccepts Spree's payloads.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"test delivery queued","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints/{id}/enable":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"patch":{"summary":"Re-enable a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Re-enables an endpoint that was manually or automatically disabled.\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint enabled","content":{"application/json":{}}}}}},"/api/v3/admin/webhook_endpoints/{id}/disable":{"parameters":[{"name":"id","in":"path","required":true,"description":"Webhook endpoint ID","schema":{"type":"string"}}],"patch":{"summary":"Disable a webhook endpoint","tags":["Webhooks"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Manually pauses an endpoint. Unlike auto-disable (triggered after\nrepeated delivery failures), no notification email is sent.\n\n\n**Required scope:** `write_webhooks` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"webhook endpoint disabled","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}}}},"/api/v3/admin/collections":{"get":{"summary":"List collections","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of the store's collections.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., rules, custom_fields, translations).","schema":{"type":"string"}}],"responses":{"200":{"description":"collections found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a manual or automatic (rule-based) collection. For automatic collections, send the full desired rule set under `rules`.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"collection created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string","enum":["all","any"]},"sort_order":{"type":"string"},"permalink":{"type":"string"},"description":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"},"rules":{"type":"array","description":"Full desired rule set. Entries with an id update, id-less entries create, omitted rules are removed.","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string"},"match_policy":{"type":"string"}}}}},"required":["name"]}}}}}},"/api/v3/admin/collections/{id}":{"get":{"summary":"Get a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single collection by ID, including its rules.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to expand (e.g., rules, custom_fields, translations).","schema":{"type":"string"}}],"responses":{"200":{"description":"collection found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"404":{"description":"collection not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a collection. Send `position` to reorder it within the flat list; send the full `rules` set to sync automatic rules.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"200":{"description":"collection updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"permalink":{"type":"string"},"description":{"type":"string"},"meta_title":{"type":"string"},"meta_description":{"type":"string"},"meta_keywords":{"type":"string"},"sort_order":{"type":"string"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string","enum":["all","any"]},"position":{"type":"integer","description":"Reorders the collection within the flat list (acts_as_list)"},"rules":{"type":"array","description":"Full desired rule set (see create).","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string"},"match_policy":{"type":"string"}}}}}}}}}},"delete":{"summary":"Delete a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a collection.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"204":{"description":"collection deleted"}}}},"/api/v3/admin/collections/{collection_id}/products":{"get":{"summary":"List collection products","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Products curated in the collection, ordered by their membership position.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"200":{"description":"products found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}}}},"post":{"summary":"Add a product to a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Curates a product into the collection (appended to the end).\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}}],"responses":{"201":{"description":"product added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"string"}},"required":["product_id"]}}}}}},"/api/v3/admin/collections/{collection_id}/products/{id}":{"delete":{"summary":"Remove a product from a collection","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes a product from the collection's manual curation.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product removed"}}}},"/api/v3/admin/collections/{collection_id}/products/{id}/reposition":{"patch":{"summary":"Reposition a collection product","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Moves a product to a new index among the collection's products.\n\n**Required scope:** `write_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"collection_id","in":"path","required":true,"description":"Collection ID","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"Product ID","schema":{"type":"string"}}],"responses":{"204":{"description":"product repositioned"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"new_position":{"type":"integer","description":"0-based index among the collection's products"}},"required":["new_position"]}}}}}},"/api/v3/admin/collection_rules/types":{"get":{"summary":"List available collection rule types","tags":["Collections"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Enumerates the registered rule kinds with their labels and descriptions — drives the rule picker on an automatic collection. Plugins extend the list by registering `Spree::CollectionRule` subclasses via `config.spree.collection_rules`. The `type` returned here is the wire shorthand accepted when writing a collection's `rules`.\n\n**Required scope:** `read_collections` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"types found","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/locations":{"get":{"summary":"List company locations","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the branches of a business customer. Each branch owns its own addresses and the buyers authorised to purchase for it.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"locations found","content":{"application/json":{}}}}},"post":{"summary":"Create a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a branch. Addresses are supplied inline and belong to the branch, so editing one later changes the branch's own record rather than an address the buyer also uses.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"location created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"billing_address":{"type":"object","description":"Created inline and owned by the branch.","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"address1":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country_code":{"type":"string"}}}},"required":["name"]}}}}}},"/api/v3/admin/company_locations/{id}":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Branches are addressed by their own id once you hold one — the company id is not needed.\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"location found","content":{"application/json":{}}}}},"patch":{"summary":"Update a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Address fields sent here edit the branch's existing address in place; send only what changes.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"200":{"description":"location updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"billing_address":{"type":"object","properties":{"city":{"type":"string"}}}}}}}}},"delete":{"summary":"Delete a company location","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Removes the branch, its buyers and the addresses it owned.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"204":{"description":"location deleted"}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List tax exemption certificates","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a business's exemption evidence. `active` is the field that decides whether a certificate\nexempts a sale: a verified certificate stops counting once its expiry date passes, so the status\nalone does not answer it.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"certificates found","content":{"application/json":{}}}}},"post":{"summary":"Create a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Records exemption evidence against a business. Certificates start `pending` and exempt nothing\nuntil verified.\n\n`country_code` and `state_code` say where the certificate holds — omit both for one valid\neverywhere, give only the country for one valid throughout it. `document` takes an ActiveStorage\nsigned blob id obtained from `POST /api/v3/admin/direct_uploads`.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"certificate created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"certificate_number":{"type":"string"},"reason_code":{"type":"string","description":"Becomes the tax provider's entity use code."},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"issuing_authority":{"type":"string","nullable":true},"document":{"type":"string","description":"ActiveStorage signed blob id from POST /api/v3/admin/direct_uploads."}},"required":["certificate_number","reason_code"]}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/verify":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Verify a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Accepts the certificate as evidence, which is what makes it exempt sales. Only a pending\ncertificate can be accepted — re-accepting a revoked one would restore evidence that was\ndeliberately withdrawn. An installation that checks numbers against a registry, or requires a\nsecond approval, can refuse here, and the refusal is returned as a validation error.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"200":{"description":"certificate verified","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/revoke":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Revoke a tax exemption certificate","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Withdraws accepted evidence. A verified certificate cannot be deleted — how a sale was taxed has to remain explainable — so revoking is the way out.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"200":{"description":"certificate revoked","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/download":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Download a certificate document","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Streams the uploaded document. Deliberately not a storage link: the bytes come through the API so\nthe same credentials apply to every read of a confidential document. Requires only read access.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"document streamed","content":{"application/json":{}}},"422":{"description":"no document attached","content":{"application/json":{}}}}}},"/api/v3/admin/companies/{company_id}/tax_identifiers":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List company tax registrations","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the business's tax registrations, one per kind. A business registration takes precedence\nover the buyer's own when a sale is for that business, because the invoice is addressed to the\nentity rather than the person who placed the order.\n\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"registrations found","content":{"application/json":{}}}}},"post":{"summary":"Create a company tax registration","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Registers a tax number against the business. Verification against the relevant registry runs in\nthe background where a validator is installed for the kind; a stock installation registers none,\nleaving the status unattempted.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"registration created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","description":"The regime the number belongs to."},"value":{"type":"string"}},"required":["kind","value"]}}}}}},"/api/v3/admin/companies/{company_id}/tax_identifiers/{id}/validate":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Re-check a company tax registration","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Asks the registry again. Manual because a registry answers only \"valid now\" — a number verified\nlast year may have been deregistered since — and because a check that came back unavailable\ncannot otherwise be retried without editing the number.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"422":{"description":"no validator installed for this kind","content":{"application/json":{}}}}}},"/api/v3/admin/companies":{"get":{"summary":"List companies","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the business customers of the current store.\n\n**Required scope:** `read_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"companies found","content":{"application/json":{}}}}},"post":{"summary":"Create a company","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a business customer. Exemption certificates and tax registrations hang off it.\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"company created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"external_id":{"type":"string","nullable":true,"description":"Your own reference for this business, unique within the store."}},"required":["name"]}}}}}},"/api/v3/admin/company_locations/{company_location_id}/contacts":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"company_location_id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"List company contacts","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the customers authorised to purchase for a branch. A customer may act for more than one branch.\n\n**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"contacts found","content":{"application/json":{}}}}},"post":{"summary":"Create a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Authorises a customer to purchase for a branch. A customer who acts for exactly one branch has\ntheir orders attributed to it automatically; one who acts for several needs the branch set on\nthe order, because guessing would invoice the wrong business.\n\n\n**Required scope:** `write_customers` (for API-key authentication).","parameters":[],"responses":{"201":{"description":"contact created","content":{"application/json":{}}},"422":{"description":"invalid request","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{"type":"string"},"role":{"type":"string","description":"Free-form label; carries no permissions in 6.0."}},"required":["customer_id"]}}}}}},"/api/v3/admin/company_contacts/{id}":{"parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `read_customers` (for API-key authentication).","responses":{"200":{"description":"contact found","content":{"application/json":{}}}}},"delete":{"summary":"Delete a company contact","tags":["Companies"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Withdraws the customer's authority to purchase for the branch. The customer account itself is untouched.\n\n**Required scope:** `write_customers` (for API-key authentication).","responses":{"204":{"description":"contact deleted"}}}},"/api/v3/admin/delivery_profiles":{"get":{"summary":"List delivery profiles","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Fulfillment profiles group products with the stock locations, delivery zones and delivery methods that fulfill them. Every store has exactly one default profile.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery profiles found","content":{"application/json":{}}}}},"post":{"summary":"Create a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery profile. `kind` selects the registered profile kind (shipping, digital, extension kinds); `stock_location_ids` limits fulfillment to those locations — empty means every store location.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"delivery profile created","content":{"application/json":{}}},"422":{"description":"validation error","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"kind":{"type":"string","description":"Registered profile kind; defaults to shipping."},"default":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"},"description":"Empty means every store location."}},"required":["name"]}}}}}},"/api/v3/admin/delivery_profiles/{delivery_profile_id}/origin_groups":{"parameters":[{"name":"delivery_profile_id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Create an origin group","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Origin groups partition a profile's fulfillment origins: zones and methods belong to a group, so the same products can quote different rate tables per warehouse. `stock_location_ids` replaces the full membership; empty means every store location.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"origin group created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","nullable":true},"position":{"type":"integer","nullable":true},"stock_location_ids":{"type":"array","items":{"type":"string"},"description":"Empty means every store location."}}}}}}}},"/api/v3/admin/delivery_profiles/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Update a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery profile updated","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"default":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"summary":"Delete a delivery profile","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"The default profile and profiles still referenced by products cannot be deleted.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"delivery profile deleted"}}}},"/api/v3/admin/delivery_methods":{"get":{"summary":"List delivery methods","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns all delivery methods with calculator and zone configuration.\n\n**Required scope:** `read_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"delivery methods found","content":{"application/json":{}}}}},"post":{"summary":"Create delivery method","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery method inside a delivery profile (defaults to the store default profile). Delivery behavior comes from the fulfillment provider.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"delivery method created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"admin_name":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"fulfillment_provider":{"type":"string","nullable":true},"delivery_profile_id":{"type":"string","nullable":true},"storefront_visible":{"type":"boolean"},"tracking_url":{"type":"string","nullable":true},"estimated_transit_business_days_min":{"type":"integer","nullable":true},"estimated_transit_business_days_max":{"type":"integer","nullable":true},"tax_category_id":{"type":"string","nullable":true},"calculator_type":{"type":"string"},"calculator_preferences":{"type":"object"},"delivery_zone_id":{"type":"string","nullable":true}},"required":["name"]}}}}}},"/api/v3/admin/delivery_methods/calculators":{"get":{"summary":"List delivery calculators","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Registered delivery calculator classes with preference schemas for building configuration forms.\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"calculators found","content":{"application/json":{}}}}}},"/api/v3/admin/delivery_zones":{"post":{"summary":"Create delivery zone","tags":["Delivery"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a delivery zone with typed members: country, state, or postal_code (prefix or from/to range).\n\n**Required scope:** `write_settings` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","required":false,"description":"Comma-separated associations to embed, e.g. `members`","schema":{"type":"string"}}],"responses":{"201":{"description":"delivery zone created","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"members":{"type":"array","items":{"type":"object","properties":{"member_type":{"type":"string","enum":["country","state","postal_code"]},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"postal_code_prefix":{"type":"string","nullable":true},"postal_code_from":{"type":"string","nullable":true},"postal_code_to":{"type":"string","nullable":true}},"required":["member_type"]}}},"required":["name"]}}}}}},"/api/v3/admin/integrations":{"get":{"summary":"List integrations","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the integrations connected to the current store. Secret preference values are masked.\n\n**Required scope:** `read_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"integrations found","content":{"application/json":{}}}}},"post":{"summary":"Connect integration","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Connects an integration type to the current store. Setting active: true verifies the connection and fails with 422 when it cannot connect. Submitting a masked secret value back keeps the stored secret.\n\n**Required scope:** `write_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"integration connected","content":{"application/json":{}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Wire shorthand from GET /integrations/types"},"active":{"type":"boolean"},"preferences":{"type":"object"}},"required":["type"]}}}}}},"/api/v3/admin/integrations/types":{"get":{"summary":"List integration types","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Every registered integration type with its gallery metadata and configuration schema. Pure registry discovery — read live connection state from GET /integrations.\n\n**Required scope:** `read_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"integration types found","content":{"application/json":{}}}}}},"/api/v3/admin/integrations/{id}/test":{"post":{"summary":"Test integration connection","tags":["Integrations"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Runs a live connection check against the provider. Nothing is persisted; a failed check reports the vendor error message.\n\n**Required scope:** `write_integrations` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"connection checked","content":{"application/json":{}}}}}},"/api/v3/admin/product_types":{"get":{"summary":"List product types","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a paginated list of product types.\n\nA product type is a back-office template: it seeds option types and\ncategories onto products created with it, and defines which custom\nfields those products' forms show. It is not exposed on the Store API.\n\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page","schema":{"type":"integer"}}],"responses":{"200":{"description":"product types found","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ProductType"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["data","meta"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Create a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Creates a product type.\n\n`option_type_ids` and `category_ids` seed products created with this\ntype. `custom_field_definitions` is a replace-set of the definitions the\nproduct form renders, in `sort_order`. `required` is advisory — the\ndashboard marks the field, but a blank value is never rejected.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"201":{"description":"product type created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}},"422":{"description":"unprocessable entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true,"description":"Fulfillment profile stamped onto products created with this type. Null leaves new products on the store default profile."},"option_type_ids":{"type":"array","items":{"type":"string"},"description":"Option types seeded onto products created with this type."},"category_ids":{"type":"array","items":{"type":"string"},"description":"Categories seeded onto products created with this type."},"custom_field_definitions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Prefixed custom field definition id."},"required":{"type":"boolean"},"sort_order":{"type":"integer"}}}}},"required":["name"]}}}}}},"/api/v3/admin/product_types/{id}":{"parameters":[{"name":"id","in":"path","description":"Product type ID","required":true,"schema":{"type":"string"}}],"get":{"summary":"Retrieve a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns a single product type with its option types, categories and custom fields.\n\n**Required scope:** `read_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"product type found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}},"404":{"description":"product type not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"summary":"Update a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Updates a product type.\n\nChanges never modify products that already carry the type — use\n`apply_to_products` to backfill those.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"200":{"description":"product type updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductType"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"option_type_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"custom_field_definitions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"required":{"type":"boolean"},"sort_order":{"type":"integer"}}}}}}}}}},"delete":{"summary":"Delete a product type","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Deletes a product type. Types still used by products cannot be deleted.\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"204":{"description":"product type deleted"}}}},"/api/v3/admin/product_types/{id}/apply_to_products":{"parameters":[{"name":"id","in":"path","description":"Product type ID","required":true,"schema":{"type":"string"}}],"post":{"summary":"Apply a product type to its existing products","tags":["Product Types"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Backfills the type's option types and categories onto the products that\nalready carry it. Additive and idempotent — nothing is removed, and\nre-running is safe.\n\nRuns in the background; the response reports how many products the type\ncurrently has.\n\n\n**Required scope:** `write_products` (for API-key authentication).","parameters":[{"name":"x-spree-api-key","in":"header","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","required":true,"description":"Bearer token for admin authentication","schema":{"type":"string"}}],"responses":{"202":{"description":"backfill accepted","content":{"application/json":{"schema":{"type":"object","properties":{"products_count":{"type":"integer"}}}}}}}}}},"components":{"schemas":{"PaginationMeta":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"count":{"type":"integer","description":"Total number of records"},"pages":{"type":"integer","description":"Total number of pages"},"from":{"type":"integer","description":"Index of first record on this page"},"to":{"type":"integer","description":"Index of last record on this page"},"in":{"type":"integer","description":"Number of records on this page"},"previous":{"type":"integer","nullable":true,"description":"Previous page number"},"next":{"type":"integer","nullable":true,"description":"Next page number"}},"required":["page","limit","count","pages","from","to","in"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","description":"Field-specific validation errors","nullable":true}},"required":["code","message"]}},"required":["error"]},"AuthResponse":{"type":"object","properties":{"token":{"type":"string","description":"JWT access token"},"user":{"$ref":"#/components/schemas/AdminUser"}},"required":["token","user"]},"PermissionRule":{"type":"object","description":"A single permission rule (CanCanCan rule). Rules are applied in order, last-matching-wins.","properties":{"allow":{"type":"boolean","description":"true for `can`, false for `cannot`"},"actions":{"type":"array","items":{"type":"string"},"description":"Action names, e.g. [\"read\", \"update\"] or [\"manage\"]"},"subjects":{"type":"array","items":{"type":"string"},"description":"Subject class names, e.g. [\"Spree::Product\"] or [\"all\"]"},"has_conditions":{"type":"boolean","description":"True if the server-side rule has per-record conditions. The SPA shows the action optimistically and handles 403 from the API."}},"required":["allow","actions","subjects","has_conditions"]},"MeResponse":{"type":"object","description":"Current admin user profile and serialized permissions","properties":{"user":{"$ref":"#/components/schemas/AdminUser"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/PermissionRule"}}},"required":["user","permissions"]},"ImportSchemaField":{"type":"object","description":"A canonical column of an import type, including per-store custom field columns","properties":{"name":{"type":"string","description":"Canonical field name used in mappings"},"label":{"type":"string","description":"Human-readable label"},"required":{"type":"boolean","description":"Whether the field must be mapped before processing"}},"required":["name","label","required"]},"CheckoutRequirement":{"type":"object","properties":{"step":{"type":"string","description":"Checkout step this requirement belongs to"},"field":{"type":"string","description":"Field that needs to be satisfied"},"message":{"type":"string","description":"Human-readable requirement message"}},"required":["step","field","message"]},"CartWarning":{"type":"object","description":"A warning about a cart issue (e.g., item removed due to stock change)","properties":{"code":{"type":"string","description":"Machine-readable warning code"},"message":{"type":"string","description":"Human-readable warning message"},"line_item_id":{"type":"string","nullable":true,"description":"Prefixed line item ID (when applicable)"},"variant_id":{"type":"string","nullable":true,"description":"Prefixed variant ID (when applicable)"},"item_index":{"type":"integer","nullable":true,"description":"Position in the submitted items array, for warnings raised while applying a batch of item changes"}},"required":["code","message"]},"FulfillmentManifestItem":{"type":"object","description":"An item within a fulfillment — which line item and how many units are in this fulfillment","properties":{"item_id":{"type":"string","description":"Line item ID"},"variant_id":{"type":"string","description":"Variant ID"},"quantity":{"type":"integer","description":"Quantity in this fulfillment"}},"required":["item_id","variant_id","quantity"]},"AdminUserRoleAssignment":{"type":"object","description":"A role assignment for the current store on a staff member","properties":{"id":{"type":"string","description":"Prefixed role ID"},"name":{"type":"string","description":"Role name"}},"required":["id","name"]},"AdminUserStore":{"type":"object","description":"A store the staff member can access through a role assignment","properties":{"id":{"type":"string","description":"Prefixed store ID"},"name":{"type":"string","description":"Store name"},"code":{"type":"string","description":"Store code"}},"required":["id","name","code"]},"PreferenceField":{"type":"object","description":"A single configurable preference on a payment method, promotion rule/action, or calculator. The frontend uses `type` + `default` to render a sensible input.","properties":{"key":{"type":"string"},"type":{"type":"string","description":"string | text | password | integer | decimal | boolean | array | hash"},"default":{"description":"Default value (any JSON type), null when there is no default","nullable":true}},"required":["key","type"]},"PromotionActionCalculator":{"type":"object","description":"The action's nested calculator (when the action carries one — null for actions like `free_shipping`)","properties":{"type":{"type":"string","description":"Wire shorthand for the calculator subclass"},"label":{"type":"string"},"preferences":{"type":"object","additionalProperties":true},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}}},"required":["type","label","preferences","preference_schema"]},"PromotionActionLineItem":{"type":"object","description":"One row in a `create_line_items` action — the variant added to the order and how many","properties":{"variant_id":{"type":"string"},"quantity":{"type":"integer"}},"required":["variant_id","quantity"]},"Address":{"type":"object","properties":{"id":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"full_name":{"type":"string"},"address1":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"postal_code":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"country_name":{"type":"string"},"country_code":{"type":"string"},"state_text":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"quick_checkout":{"type":"boolean"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"},"state_abbr":{"type":"string","nullable":true},"country_iso":{"type":"string"},"state_name":{"type":"string","nullable":true},"label":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true}},"required":["id","first_name","last_name","full_name","address1","address2","postal_code","city","phone","company","country_name","country_code","state_text","state_code","quick_checkout","is_default_billing","is_default_shipping","state_abbr","country_iso","state_name","label","metadata","created_at","updated_at","customer_id"],"x-typelizer":true},"AdminUser":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"full_name":{"type":"string","nullable":true},"selected_locale":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"avatar_url":{"type":"string","nullable":true},"roles":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserRoleAssignment"}},"stores":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserStore"}}},"required":["id","email","first_name","last_name","full_name","selected_locale","created_at","updated_at","avatar_url","roles","stores"],"x-typelizer":true},"AllowedOrigin":{"type":"object","properties":{"id":{"type":"string"},"origin":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","origin","created_at","updated_at"],"x-typelizer":true},"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"key_type":{"type":"string"},"token_prefix":{"type":"string","nullable":true},"scopes":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"revoked_at":{"type":"string","nullable":true},"last_used_at":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"plaintext_token":{"type":"string","nullable":true},"created_by_email":{"type":"string","nullable":true}},"required":["id","name","key_type","token_prefix","scopes","created_at","updated_at","revoked_at","last_used_at","channel_id","plaintext_token","created_by_email"],"x-typelizer":true},"AppliedPromotion":{"type":"object","properties":{"id":{"type":"string"},"promotion_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","promotion_id","name","description","code","amount","display_amount","created_at","updated_at"],"x-typelizer":true},"Cart":{"type":"object","properties":{"id":{"type":"string"},"market_id":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"preferred_stock_location_id":{"type":"string","nullable":true},"number":{"type":"string"},"token":{"type":"string"},"email":{"type":"string","nullable":true},"customer_note":{"type":"string","nullable":true},"currency":{"type":"string"},"locale":{"type":"string","nullable":true},"total_quantity":{"type":"number"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/CartWarning"}},"coupon_code":{"type":"string","nullable":true},"item_total":{"type":"string","nullable":true},"display_item_total":{"type":"string","nullable":true},"adjustment_total":{"type":"string","nullable":true},"display_adjustment_total":{"type":"string","nullable":true},"discount_total":{"type":"string","nullable":true},"display_discount_total":{"type":"string","nullable":true},"tax_total":{"type":"string","nullable":true},"display_tax_total":{"type":"string","nullable":true},"included_tax_total":{"type":"string","nullable":true},"display_included_tax_total":{"type":"string","nullable":true},"additional_tax_total":{"type":"string","nullable":true},"display_additional_tax_total":{"type":"string","nullable":true},"total":{"type":"string","nullable":true},"display_total":{"type":"string","nullable":true},"gift_card_total":{"type":"string","nullable":true},"display_gift_card_total":{"type":"string","nullable":true},"amount_due":{"type":"string","nullable":true},"display_amount_due":{"type":"string","nullable":true},"delivery_total":{"type":"string","nullable":true},"display_delivery_total":{"type":"string","nullable":true},"store_credit_total":{"type":"string","nullable":true},"display_store_credit_total":{"type":"string","nullable":true},"covered_by_store_credit":{"type":"boolean"},"current_step":{"type":"string"},"completed_steps":{"type":"array","items":{"type":"string"}},"requirements":{"type":"array","items":{"$ref":"#/components/schemas/CheckoutRequirement"}},"shipping_eq_billing_address":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"}},"billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true},"completed_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"applied_promotions":{"type":"array","items":{"$ref":"#/components/schemas/AppliedPromotion"}}},"required":["id","market_id","channel_id","preferred_stock_location_id","number","token","email","customer_note","currency","locale","total_quantity","warnings","coupon_code","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","store_credit_total","display_store_credit_total","covered_by_store_credit","current_step","completed_steps","requirements","shipping_eq_billing_address","items","billing_address","shipping_address","market","completed_at","created_at","updated_at","applied_promotions"],"x-typelizer":true},"Category":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"permalink":{"type":"string"},"position":{"type":"number"},"depth":{"type":"number"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"children_count":{"type":"number"},"parent_id":{"type":"string","nullable":true},"description":{"type":"string"},"description_html":{"type":"string"},"image_url":{"type":"string","nullable":true},"square_image_url":{"type":"string","nullable":true},"is_root":{"type":"boolean"},"is_child":{"type":"boolean"},"is_leaf":{"type":"boolean"},"parent":{"$ref":"#/components/schemas/Category"},"children":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"ancestors":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"translations":{"type":"object"},"metadata":{"type":"object"},"pretty_name":{"type":"string"},"lft":{"type":"number"},"rgt":{"type":"number"},"products_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","permalink","position","depth","meta_title","meta_description","meta_keywords","children_count","parent_id","description","description_html","image_url","square_image_url","is_root","is_child","is_leaf","metadata","pretty_name","lft","rgt","products_count","created_at","updated_at"],"x-typelizer":true},"Channel":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string"},"active":{"type":"boolean"},"default":{"type":"boolean"},"storefront_access":{"type":"string"},"guest_checkout":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string","nullable":true},"preferred_storefront_access":{"type":"string","nullable":true},"preferred_guest_checkout":{"type":"boolean","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","code","active","default","storefront_access","guest_checkout","preferred_order_routing_strategy","preferred_storefront_access","preferred_guest_checkout","created_at","updated_at","stock_location_ids"],"x-typelizer":true},"ClaimLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"send_replacement":{"type":"boolean"},"description":{"type":"string","nullable":true},"refund_amount":{"type":"string"},"paid_amount":{"type":"string"},"display_refund_amount":{"type":"string"},"variant_id":{"type":"string","nullable":true},"replacement_variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"replacement_variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","quantity","send_replacement","description","refund_amount","paid_amount","display_refund_amount","variant_id","replacement_variant_id","line_item_id","created_at","updated_at"],"x-typelizer":true},"ClaimReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Claim":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"resolution":{"type":"string","nullable":true},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"refund_total":{"type":"string"},"display_refund_total":{"type":"string"},"approved_at":{"type":"string","nullable":true},"resolved_at":{"type":"string","nullable":true},"denied_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ClaimReason"},"claim_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ClaimLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"created_by_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","resolution","order_id","reason_id","refund_total","display_refund_total","approved_at","resolved_at","denied_at","canceled_at","memo","metadata","created_at","updated_at","created_by_id"],"x-typelizer":true},"CollectionRule":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"value":{"type":"string","nullable":true},"match_policy":{"type":"string"}},"required":["id","type","value","match_policy"],"x-typelizer":true},"Collection":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"permalink":{"type":"string"},"position":{"type":"number"},"sort_order":{"type":"string"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"products_count":{"type":"number"},"description":{"type":"string"},"description_html":{"type":"string"},"image_url":{"type":"string","nullable":true},"square_image_url":{"type":"string","nullable":true},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"translations":{"type":"object"},"automatic":{"type":"boolean"},"rules_match_policy":{"type":"string"},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"rules":{"type":"array","items":{"$ref":"#/components/schemas/CollectionRule"}}},"required":["id","name","permalink","position","sort_order","meta_title","meta_description","meta_keywords","products_count","description","description_html","image_url","square_image_url","automatic","rules_match_policy","metadata","created_at","updated_at"],"x-typelizer":true},"CompanyContact":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_location_id":{"type":"string"},"customer_id":{"type":"string"},"email":{"type":"string","nullable":true}},"required":["id","role","created_at","updated_at","company_location_id","customer_id","email"],"x-typelizer":true},"CompanyLocation":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_id":{"type":"string"},"contacts_count":{"type":"number"},"billing_address":{"$ref":"#/components/schemas/Address"},"shipping_address":{"$ref":"#/components/schemas/Address"},"company_contacts":{"type":"array","items":{"$ref":"#/components/schemas/CompanyContact"}}},"required":["id","name","external_id","metadata","created_at","updated_at","company_id","contacts_count","billing_address","shipping_address"],"x-typelizer":true},"Company":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"external_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"locations_count":{"type":"number"},"company_locations":{"type":"array","items":{"$ref":"#/components/schemas/CompanyLocation"}}},"required":["id","name","external_id","metadata","created_at","updated_at","locations_count"],"x-typelizer":true},"Country":{"type":"object","properties":{"iso":{"type":"string"},"iso3":{"type":"string"},"name":{"type":"string"},"states_required":{"type":"boolean"},"zipcode_required":{"type":"boolean"},"states":{"type":"array","items":{"$ref":"#/components/schemas/State"}},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true}},"required":["iso","iso3","name","states_required","zipcode_required"],"x-typelizer":true},"CouponCode":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"state":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"promotion_id":{"type":"string"},"order_id":{"type":"string","nullable":true}},"required":["id","code","state","created_at","updated_at","promotion_id","order_id"],"x-typelizer":true},"CreditCard":{"type":"object","properties":{"id":{"type":"string"},"brand":{"type":"string"},"last4":{"type":"string"},"month":{"type":"number"},"year":{"type":"number"},"name":{"type":"string","nullable":true},"default":{"type":"boolean"},"gateway_payment_profile_id":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true},"payment_method_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","brand","last4","month","year","name","default","gateway_payment_profile_id","customer_id","payment_method_id","metadata","created_at","updated_at"],"x-typelizer":true},"CustomFieldDefinition":{"type":"object","properties":{"id":{"type":"string"},"namespace":{"type":"string"},"key":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"resource_type":{"type":"string"},"storefront_visible":{"type":"boolean"},"searchable":{"type":"boolean"},"sortable":{"type":"boolean"},"filter_key":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","namespace","key","label","field_type","resource_type","storefront_visible","searchable","sortable","filter_key","created_at","updated_at"],"x-typelizer":true},"CustomField":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","deprecated":true},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"key":{"type":"string"},"value":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"storefront_visible":{"type":"boolean"},"custom_field_definition_id":{"type":"string"}},"required":["id","label","type","field_type","key","value","created_at","updated_at","storefront_visible","custom_field_definition_id"],"x-typelizer":true},"CustomerGroup":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"customers_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}},"required":["id","name","description","customers_count","created_at","updated_at"],"x-typelizer":true},"Customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"accepts_email_marketing":{"type":"boolean"},"full_name":{"type":"string"},"available_store_credit_total":{"type":"string"},"display_available_store_credit_total":{"type":"string"},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/Address"}},"default_billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"default_shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"newsletter_subscriber":{"allOf":[{"$ref":"#/components/schemas/NewsletterSubscriber"}],"nullable":true},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"failed_attempts":{"type":"number"},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"internal_note":{"type":"string","nullable":true},"internal_note_html":{"type":"string","nullable":true},"default_billing_address_id":{"type":"string","nullable":true},"default_shipping_address_id":{"type":"string","nullable":true},"orders_count":{"type":"number"},"total_spent":{"type":"string"},"display_total_spent":{"type":"string"},"last_order_completed_at":{"type":"string","nullable":true},"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"store_credits":{"type":"array","items":{"$ref":"#/components/schemas/StoreCredit"}},"customer_group_ids":{"type":"array","items":{"type":"string"}}},"required":["id","email","first_name","last_name","phone","accepts_email_marketing","full_name","available_store_credit_total","display_available_store_credit_total","failed_attempts","metadata","created_at","updated_at","tags","internal_note","internal_note_html","default_billing_address_id","default_shipping_address_id","orders_count","total_spent","display_total_spent","last_order_completed_at","customer_group_ids"],"x-typelizer":true},"DeliveryMethodRule":{"type":"object","properties":{"id":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"},"product_ids":{"type":"array","items":{"type":"string"}}},"required":["id","active","created_at","updated_at","type","name","description","preferences","preference_schema","product_ids"],"x-typelizer":true},"DeliveryMethod":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string","nullable":true},"estimated_transit_business_days_min":{"type":"number","nullable":true},"estimated_transit_business_days_max":{"type":"number","nullable":true},"digital":{"type":"boolean"},"pickup":{"type":"boolean"},"pickup_point":{"type":"boolean"},"admin_name":{"type":"string","nullable":true},"fulfillment_provider":{"type":"string"},"pickup_point_provider":{"type":"string","nullable":true},"rate_provider":{"type":"string","nullable":true},"storefront_visible":{"type":"boolean"},"tracking_url":{"type":"string","nullable":true},"markup_flat":{"type":"string","nullable":true},"markup_percent":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string"},"services":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryMethodService"}},"rules":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryMethodRule"}},"tax_category_id":{"type":"string","nullable":true},"delivery_profile_id":{"type":"string"},"delivery_origin_group_id":{"type":"string","nullable":true},"delivery_zone_id":{"type":"string","nullable":true},"stock_location_ids":{"type":"array","items":{"type":"string"}},"calculator_type":{"type":"string","nullable":true},"calculator_preferences":{"type":"object","nullable":true}},"required":["id","name","code","estimated_transit_business_days_min","estimated_transit_business_days_max","digital","pickup","pickup_point","admin_name","fulfillment_provider","pickup_point_provider","rate_provider","storefront_visible","tracking_url","markup_flat","markup_percent","created_at","updated_at","deleted_at","services","rules","tax_category_id","delivery_profile_id","delivery_origin_group_id","delivery_zone_id","stock_location_ids","calculator_type","calculator_preferences"],"x-typelizer":true},"DeliveryMethodService":{"type":"object","properties":{"id":{"type":"string"},"carrier":{"type":"string"},"service":{"type":"string"},"label":{"type":"string","nullable":true},"markup_flat":{"type":"string","nullable":true},"markup_percent":{"type":"string","nullable":true},"position":{"type":"number"}},"required":["id","carrier","service","label","markup_flat","markup_percent","position"],"x-typelizer":true},"DeliveryOriginGroup":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true},"position":{"type":"number","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string"},"stock_location_ids":{"type":"array","items":{"type":"string"}},"delivery_zones_count":{"type":"number"},"delivery_methods_count":{"type":"number"}},"required":["id","name","position","created_at","updated_at","delivery_profile_id","stock_location_ids","delivery_zones_count","delivery_methods_count"],"x-typelizer":true},"DeliveryProfile":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"default":{"type":"boolean"},"position":{"type":"number","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"kind":{"type":"string"},"digital":{"type":"boolean"},"offers_pickup":{"type":"boolean"},"offers_shipping":{"type":"boolean"},"stock_location_ids":{"type":"array","items":{"type":"string"}},"origin_groups":{"type":"object"},"products_count":{"type":"number"},"delivery_methods_count":{"type":"number"},"delivery_zones_count":{"type":"number"}},"required":["id","name","default","position","created_at","updated_at","kind","digital","offers_pickup","offers_shipping","stock_location_ids","origin_groups","products_count","delivery_methods_count","delivery_zones_count"],"x-typelizer":true},"DeliveryRate":{"type":"object","properties":{"id":{"type":"string"},"delivery_method_id":{"type":"string"},"name":{"type":"string"},"selected":{"type":"boolean"},"cost":{"type":"string"},"total":{"type":"string"},"additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"tax_total":{"type":"string"},"carrier":{"type":"string","nullable":true},"service_level":{"type":"string","nullable":true},"estimated_delivery_date":{"type":"string","nullable":true},"display_cost":{"type":"string"},"display_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"delivery_method":{"$ref":"#/components/schemas/DeliveryMethod"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","delivery_method_id","name","selected","cost","total","additional_tax_total","included_tax_total","tax_total","carrier","service_level","estimated_delivery_date","display_cost","display_total","display_additional_tax_total","display_included_tax_total","display_tax_total","metadata","created_at","updated_at"],"x-typelizer":true},"DeliveryZoneMember":{"type":"object","properties":{"id":{"type":"string"},"member_type":{"type":"string"},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"postal_code_prefix":{"type":"string","nullable":true},"postal_code_from":{"type":"string","nullable":true},"postal_code_to":{"type":"string","nullable":true},"country_name":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","member_type","country_code","state_code","postal_code_prefix","postal_code_from","postal_code_to","country_name","state_name","created_at","updated_at"],"x-typelizer":true},"DeliveryZone":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"members":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryZoneMember"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string"},"delivery_origin_group_id":{"type":"string","nullable":true},"delivery_method_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","description","created_at","updated_at","delivery_profile_id","delivery_origin_group_id","delivery_method_ids"],"x-typelizer":true},"DigitalLink":{"type":"object","properties":{"id":{"type":"string"},"access_counter":{"type":"number"},"filename":{"type":"string"},"content_type":{"type":"string"},"download_url":{"type":"string"},"authorizable":{"type":"boolean"},"expired":{"type":"boolean"},"access_limit_exceeded":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","access_counter","filename","content_type","download_url","authorizable","expired","access_limit_exceeded","created_at","updated_at"],"x-typelizer":true},"Discount":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"code":{"type":"string","nullable":true},"value_type":{"type":"string","nullable":true},"value":{"type":"string","nullable":true},"promotion_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","kind","code","value_type","value","promotion_id","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":true},"ExchangeLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"received_quantity":{"type":"number"},"resellable":{"type":"boolean"},"original_price":{"type":"string"},"new_variant_price":{"type":"string"},"price_difference":{"type":"string"},"original_variant_id":{"type":"string","nullable":true},"new_variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_item_id":{"type":"string","nullable":true},"original_variant":{"$ref":"#/components/schemas/Variant"},"new_variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","quantity","received_quantity","resellable","original_price","new_variant_price","price_difference","original_variant_id","new_variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":true},"Exchange":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"price_difference":{"type":"string"},"display_price_difference":{"type":"string"},"approved_at":{"type":"string","nullable":true},"received_at":{"type":"string","nullable":true},"fulfilled_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ReturnReason"},"exchange_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ExchangeLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","order_id","reason_id","price_difference","display_price_difference","approved_at","received_at","fulfilled_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id"],"x-typelizer":true},"Export":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"format":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true},"done":{"type":"boolean"},"filename":{"type":"string","nullable":true},"byte_size":{"type":"number","nullable":true},"download_url":{"type":"string","nullable":true}},"required":["id","number","format","created_at","updated_at","type","user_id","done","filename","byte_size","download_url"],"x-typelizer":true},"Fee":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","kind","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":true},"FulfillmentItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"status":{"type":"string"},"variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"options_text":{"type":"string","nullable":true}},"required":["id","quantity","status","variant_id","line_item_id","name","options_text"],"x-typelizer":true},"Fulfillment":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"tracking":{"type":"string","nullable":true},"tracking_url":{"type":"string","nullable":true},"tracking_carrier":{"type":"string","nullable":true},"tracking_carrier_name":{"type":"string","nullable":true},"pickup_point_data":{"type":"object","nullable":true},"selected_delivery_rate_id":{"type":"string","nullable":true},"cost":{"type":"string"},"display_cost":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"status":{"type":"string"},"fulfillment_type":{"type":"string"},"fulfilled_at":{"type":"string","nullable":true},"tracking_status":{"type":"string","nullable":true},"estimated_delivery_at":{"type":"string","nullable":true},"delivered_at":{"type":"string","nullable":true},"items":{"type":"array","items":{"$ref":"#/components/schemas/FulfillmentManifestItem"}},"delivery_method":{"$ref":"#/components/schemas/DeliveryMethod"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"delivery_rates":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryRate"}},"tax_lines":{"type":"array","items":{"$ref":"#/components/schemas/TaxLine"}},"metadata":{"type":"object"},"tracking_details":{"type":"object","nullable":true},"adjustment_total":{"type":"string"},"pre_tax_amount":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"order_id":{"type":"string","nullable":true},"stock_location_id":{"type":"string","nullable":true},"documents":{"type":"object"},"provider_generates_labels":{"type":"boolean"},"fulfillment_items":{"type":"array","items":{"$ref":"#/components/schemas/FulfillmentItem"}},"order":{"$ref":"#/components/schemas/Order"}},"required":["id","number","tracking","tracking_url","tracking_carrier","tracking_carrier_name","pickup_point_data","selected_delivery_rate_id","cost","display_cost","total","display_total","discount_total","display_discount_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","tax_total","display_tax_total","status","fulfillment_type","fulfilled_at","tracking_status","estimated_delivery_at","delivered_at","items","metadata","tracking_details","adjustment_total","pre_tax_amount","created_at","updated_at","order_id","stock_location_id","documents","provider_generates_labels"],"x-typelizer":true},"GiftCardBatch":{"type":"object","properties":{"id":{"type":"string"},"codes_count":{"type":"number"},"currency":{"type":"string","nullable":true},"prefix":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"amount":{"type":"string","nullable":true},"expires_at":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true}},"required":["id","codes_count","currency","prefix","created_at","updated_at","amount","expires_at","created_by_id"],"x-typelizer":true},"GiftCard":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string"},"amount_used":{"type":"string"},"amount_authorized":{"type":"string"},"amount_remaining":{"type":"string"},"display_amount":{"type":"string"},"display_amount_used":{"type":"string"},"display_amount_remaining":{"type":"string"},"expires_at":{"type":"string","nullable":true},"redeemed_at":{"type":"string","nullable":true},"expired":{"type":"boolean"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"customer":{"$ref":"#/components/schemas/Customer"},"created_by":{"$ref":"#/components/schemas/AdminUser"},"gift_card_batch":{"$ref":"#/components/schemas/GiftCardBatch"},"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}}},"required":["id","code","status","currency","amount","amount_used","amount_authorized","amount_remaining","display_amount","display_amount_used","display_amount_remaining","expires_at","redeemed_at","expired","active","created_at","updated_at","customer_id","created_by_id"],"x-typelizer":true},"ImportMapping":{"type":"object","properties":{"id":{"type":"string"},"schema_field":{"type":"string"},"file_column":{"type":"string","nullable":true},"required":{"type":"boolean"}},"required":["id","schema_field","file_column","required"],"x-typelizer":true},"ImportRow":{"type":"object","properties":{"id":{"type":"string"},"row_number":{"type":"number"},"status":{"type":"string"},"validation_errors":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"import_id":{"type":"string","nullable":true},"item_type":{"type":"string","nullable":true},"item_id":{"type":"string","nullable":true},"data":{"type":"object"}},"required":["id","row_number","status","validation_errors","created_at","updated_at","import_id","item_type","item_id","data"],"x-typelizer":true},"Import":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"rows_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string","nullable":true},"status":{"type":"string"},"owner_type":{"type":"string","nullable":true},"owner_id":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true},"processing_errors":{"type":"string","nullable":true},"preferred_delimiter":{"type":"string"},"original_filename":{"type":"string","nullable":true},"original_byte_size":{"type":"number","nullable":true},"original_file_url":{"type":"string","nullable":true},"completed_rows_count":{"type":"number"},"failed_rows_count":{"type":"number"},"schema_fields":{"type":"array","items":{"$ref":"#/components/schemas/ImportSchemaField"}},"csv_headers":{"type":"array","items":{"type":"string"}},"sample_row":{"type":"object"},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/ImportMapping"}}},"required":["id","number","rows_count","created_at","updated_at","type","status","owner_type","owner_id","user_id","processing_errors","preferred_delimiter","original_filename","original_byte_size","original_file_url","completed_rows_count","failed_rows_count","schema_fields","csv_headers","sample_row","mappings"],"x-typelizer":true},"Integration":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"group":{"type":"string","nullable":true},"preferences":{"type":"object"},"preference_schema":{"type":"object"}},"required":["id","name","active","created_at","updated_at","type","group","preferences","preference_schema"],"x-typelizer":true},"Invitation":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"status":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"expires_at":{"type":"string"},"role_id":{"type":"string"},"role_name":{"type":"string"},"inviter_email":{"type":"string"},"acceptance_url":{"type":"string"},"invitee_exists":{"type":"boolean"},"store":{"type":"object"}},"required":["id","email","status","created_at","updated_at","expires_at","role_id","role_name","inviter_email","acceptance_url","invitee_exists","store"],"x-typelizer":true},"LineItem":{"type":"object","properties":{"id":{"type":"string"},"variant_id":{"type":"string"},"preorder":{"type":"boolean"},"preorder_ships_at":{"type":"string","nullable":true},"quantity":{"type":"number"},"currency":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"options_text":{"type":"string"},"price":{"type":"string"},"display_price":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"adjustment_total":{"type":"string"},"display_adjustment_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"pre_tax_amount":{"type":"string"},"display_pre_tax_amount":{"type":"string"},"discounted_amount":{"type":"string"},"display_discounted_amount":{"type":"string"},"display_compare_at_amount":{"type":"string","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"thumbnail_url":{"type":"string","nullable":true},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"digital_links":{"type":"array","items":{"$ref":"#/components/schemas/DigitalLink"}},"tax_lines":{"type":"array","items":{"$ref":"#/components/schemas/TaxLine"}},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"cost_price":{"type":"string","nullable":true},"tax_category_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"tax_category":{"$ref":"#/components/schemas/TaxCategory"}},"required":["id","variant_id","preorder","preorder_ships_at","quantity","currency","name","slug","options_text","price","display_price","total","display_total","adjustment_total","display_adjustment_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","discount_total","display_discount_total","pre_tax_amount","display_pre_tax_amount","discounted_amount","display_discounted_amount","display_compare_at_amount","compare_at_amount","thumbnail_url","option_values","digital_links","metadata","created_at","updated_at","cost_price","tax_category_id"],"x-typelizer":true},"Market":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"currency":{"type":"string"},"default_locale":{"type":"string"},"tax_inclusive":{"type":"boolean"},"default":{"type":"boolean"},"country_codes":{"type":"array","items":{"type":"string"}},"supported_locales":{"type":"array","items":{"type":"string"}},"countries":{"type":"array","items":{"$ref":"#/components/schemas/Country"}},"tax_provider":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","currency","default_locale","tax_inclusive","default","country_codes","supported_locales","tax_provider","created_at","updated_at"],"x-typelizer":true},"Media":{"type":"object","properties":{"id":{"type":"string"},"product_id":{"type":"string","nullable":true},"variant_ids":{"type":"array","items":{"type":"string"}},"position":{"type":"number"},"alt":{"type":"string","nullable":true},"media_type":{"type":"string"},"focal_point_x":{"type":"number","nullable":true},"focal_point_y":{"type":"number","nullable":true},"external_video_url":{"type":"string","nullable":true},"original_url":{"type":"string","nullable":true},"mini_url":{"type":"string","nullable":true},"small_url":{"type":"string","nullable":true},"medium_url":{"type":"string","nullable":true},"large_url":{"type":"string","nullable":true},"xlarge_url":{"type":"string","nullable":true},"og_image_url":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"viewable_id":{"type":"string"},"download_url":{"type":"string","nullable":true},"metadata":{"type":"object"},"viewable_type":{"type":"string"}},"required":["id","product_id","variant_ids","position","alt","media_type","focal_point_x","focal_point_y","external_video_url","original_url","mini_url","small_url","medium_url","large_url","xlarge_url","og_image_url","created_at","updated_at","viewable_id","download_url","metadata","viewable_type"],"x-typelizer":true},"NewsletterSubscriber":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"verified":{"type":"boolean"},"verified_at":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true}},"required":["id","email","created_at","updated_at","verified","verified_at","customer_id"],"x-typelizer":true},"OptionType":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"number"},"kind":{"type":"string"},"translations":{"type":"object"},"metadata":{"type":"object"},"filterable":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}}},"required":["id","name","label","position","kind","metadata","filterable","created_at","updated_at"],"x-typelizer":true},"OptionValue":{"type":"object","properties":{"id":{"type":"string"},"option_type_id":{"type":"string"},"name":{"type":"string"},"label":{"type":"string"},"position":{"type":"number"},"color_code":{"type":"string","nullable":true},"option_type_name":{"type":"string"},"option_type_label":{"type":"string"},"image_url":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"option_type":{"$ref":"#/components/schemas/OptionType"}},"required":["id","option_type_id","name","label","position","color_code","option_type_name","option_type_label","image_url","metadata","created_at","updated_at"],"x-typelizer":true},"OrderRoutingRule":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"number"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"channel_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"},"label":{"type":"string"},"description":{"type":"string"}},"required":["id","position","active","created_at","updated_at","type","channel_id","preferences","preference_schema","label","description"],"x-typelizer":true},"Order":{"type":"object","properties":{"id":{"type":"string"},"market_id":{"type":"string","nullable":true},"cart_id":{"type":"string","nullable":true},"channel_id":{"type":"string","nullable":true},"number":{"type":"string"},"email":{"type":"string"},"customer_note":{"type":"string","nullable":true},"currency":{"type":"string"},"locale":{"type":"string","nullable":true},"total_quantity":{"type":"number"},"coupon_code":{"type":"string","nullable":true},"fulfillment_status":{"type":"string","nullable":true},"payment_status":{"type":"string","nullable":true},"completed_at":{"type":"string","nullable":true},"item_total":{"type":"string"},"display_item_total":{"type":"string"},"adjustment_total":{"type":"string"},"display_adjustment_total":{"type":"string"},"discount_total":{"type":"string"},"display_discount_total":{"type":"string"},"tax_total":{"type":"string"},"display_tax_total":{"type":"string"},"included_tax_total":{"type":"string"},"display_included_tax_total":{"type":"string"},"additional_tax_total":{"type":"string"},"display_additional_tax_total":{"type":"string"},"total":{"type":"string"},"display_total":{"type":"string"},"gift_card_total":{"type":"string"},"display_gift_card_total":{"type":"string"},"amount_due":{"type":"string"},"display_amount_due":{"type":"string"},"delivery_total":{"type":"string"},"display_delivery_total":{"type":"string"},"store_credit_total":{"type":"string"},"display_store_credit_total":{"type":"string"},"covered_by_store_credit":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"}},"fulfillments":{"type":"array","items":{"$ref":"#/components/schemas/Fulfillment"}},"payments":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}},"billing_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"shipping_address":{"allOf":[{"$ref":"#/components/schemas/Address"}],"nullable":true},"gift_card":{"allOf":[{"$ref":"#/components/schemas/GiftCard"}],"nullable":true},"market":{"allOf":[{"$ref":"#/components/schemas/Market"}],"nullable":true},"status":{"type":"string"},"last_ip_address":{"type":"string","nullable":true},"considered_risky":{"type":"boolean"},"confirmation_delivered":{"type":"boolean"},"store_owner_notification_delivered":{"type":"boolean"},"payment_total":{"type":"string"},"display_payment_total":{"type":"string"},"metadata":{"type":"object"},"canceled_at":{"type":"string","nullable":true},"approved_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preferred_stock_location_id":{"type":"string","nullable":true},"company_location_id":{"type":"string","nullable":true},"company_id":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"}},"internal_note":{"type":"string","nullable":true},"internal_note_html":{"type":"string","nullable":true},"approver_id":{"type":"string","nullable":true},"canceler_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"customer_id":{"type":"string","nullable":true},"applied_promotions":{"type":"array","items":{"$ref":"#/components/schemas/AppliedPromotion"}},"cart":{"$ref":"#/components/schemas/Cart"},"channel":{"$ref":"#/components/schemas/Channel"},"preferred_stock_location":{"$ref":"#/components/schemas/StockLocation"},"payment_methods":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethod"}},"customer":{"$ref":"#/components/schemas/Customer"},"approver":{"$ref":"#/components/schemas/Customer"},"canceler":{"$ref":"#/components/schemas/Customer"},"created_by":{"$ref":"#/components/schemas/Customer"},"returns":{"type":"array","items":{"$ref":"#/components/schemas/Return"}},"exchanges":{"type":"array","items":{"$ref":"#/components/schemas/Exchange"}},"claims":{"type":"array","items":{"$ref":"#/components/schemas/Claim"}}},"required":["id","market_id","cart_id","channel_id","number","email","customer_note","currency","locale","total_quantity","coupon_code","fulfillment_status","payment_status","completed_at","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","store_credit_total","display_store_credit_total","covered_by_store_credit","gift_card","market","status","last_ip_address","considered_risky","confirmation_delivered","store_owner_notification_delivered","payment_total","display_payment_total","metadata","canceled_at","approved_at","created_at","updated_at","preferred_stock_location_id","company_location_id","company_id","tags","internal_note","internal_note_html","approver_id","canceler_id","created_by_id","customer_id"],"x-typelizer":true},"PaymentMethod":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"type":{"type":"string"},"session_required":{"type":"boolean"},"source_required":{"type":"boolean"},"metadata":{"type":"object"},"active":{"type":"boolean"},"auto_capture":{"type":"boolean","nullable":true},"capture_method":{"type":"string","enum":["checkout","on_dispatch","manual"],"nullable":true},"resolved_capture_method":{"type":"string","enum":["checkout","on_dispatch","manual"]},"storefront_visible":{"type":"boolean"},"position":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"object"}},"required":["id","name","description","type","session_required","source_required","metadata","active","auto_capture","capture_method","resolved_capture_method","storefront_visible","position","created_at","updated_at","preferences","preference_schema"],"x-typelizer":true},"Payment":{"type":"object","properties":{"id":{"type":"string"},"payment_method_id":{"type":"string"},"response_code":{"type":"string","nullable":true},"number":{"type":"string"},"amount":{"type":"string"},"display_amount":{"type":"string"},"status":{"type":"string"},"source_type":{"type":"string","nullable":true,"enum":["credit_card","store_credit","payment_source"]},"source_id":{"type":"string","nullable":true},"source":{"anyOf":[{"$ref":"#/components/schemas/CreditCard"},{"$ref":"#/components/schemas/StoreCredit"},{"$ref":"#/components/schemas/PaymentSource"}],"nullable":true},"payment_method":{"$ref":"#/components/schemas/PaymentMethod"},"metadata":{"type":"object"},"avs_response":{"type":"string","nullable":true},"cvv_response_code":{"type":"string","nullable":true},"cvv_response_message":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"captured_amount":{"type":"string"},"order_id":{"type":"string","nullable":true},"order":{"$ref":"#/components/schemas/Order"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","payment_method_id","response_code","number","amount","display_amount","status","source_type","source_id","source","metadata","avs_response","cvv_response_code","cvv_response_message","created_at","updated_at","captured_amount","order_id"],"x-typelizer":true},"PaymentSource":{"type":"object","properties":{"id":{"type":"string"},"gateway_payment_profile_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","gateway_payment_profile_id","metadata","created_at","updated_at"],"x-typelizer":true},"Permission":{"type":"object","properties":{"key":{"type":"string"},"resource":{"type":"string"},"kind":{"type":"string"},"group":{"type":"string"},"group_label":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"}},"required":["key","resource","kind","group","group_label","label","description"],"x-typelizer":true},"PriceHistory":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string"},"amount_in_cents":{"type":"number"},"currency":{"type":"string"},"display_amount":{"type":"string"},"recorded_at":{"type":"string"},"variant_id":{"type":"string"},"price_id":{"type":"string"},"compare_at_amount":{"type":"string","nullable":true},"created_at":{"type":"string"}},"required":["id","amount","amount_in_cents","currency","display_amount","recorded_at","variant_id","price_id","compare_at_amount","created_at"],"x-typelizer":true},"PriceList":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"position":{"type":"number"},"match_policy":{"type":"string"},"starts_at":{"type":"string","nullable":true},"ends_at":{"type":"string","nullable":true},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"currently_active":{"type":"boolean"},"products_count":{"type":"number"},"prices_count":{"type":"number"},"product_ids":{"type":"array","items":{"type":"string"}},"price_rules":{"type":"array","items":{"$ref":"#/components/schemas/PriceRule"}}},"required":["id","name","description","status","position","match_policy","starts_at","ends_at","deleted_at","created_at","updated_at","currently_active","products_count","prices_count","product_ids"],"x-typelizer":true},"PriceRule":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"price_list_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"description":{"type":"string","nullable":true},"markets":{"type":"array","items":{"$ref":"#/components/schemas/Market"}},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}},"required":["id","created_at","updated_at","type","price_list_id","preferences","preference_schema","label","description"],"x-typelizer":true},"Price":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string","nullable":true},"amount_in_cents":{"type":"number","nullable":true},"compare_at_amount":{"type":"string","nullable":true},"compare_at_amount_in_cents":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"display_amount":{"type":"string","nullable":true},"display_compare_at_amount":{"type":"string","nullable":true},"price_list_id":{"type":"string","nullable":true},"variant_id":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","amount","amount_in_cents","compare_at_amount","compare_at_amount_in_cents","currency","display_amount","display_compare_at_amount","price_list_id","variant_id","created_at","updated_at"],"x-typelizer":true},"ProductPublication":{"type":"object","properties":{"id":{"type":"string"},"published_at":{"type":"string","nullable":true},"unpublished_at":{"type":"string","nullable":true},"product_id":{"type":"string"},"channel_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","published_at","unpublished_at","product_id","channel_id","created_at","updated_at"],"x-typelizer":true},"Product":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"meta_title":{"type":"string","nullable":true},"meta_description":{"type":"string","nullable":true},"meta_keywords":{"type":"string","nullable":true},"variant_count":{"type":"number"},"available_on":{"type":"string","nullable":true},"preorder_ships_at":{"type":"string","nullable":true},"purchasable":{"type":"boolean"},"preorder":{"type":"boolean"},"in_stock":{"type":"boolean"},"backorderable":{"type":"boolean"},"available":{"type":"boolean"},"description":{"type":"string","nullable":true},"description_html":{"type":"string","nullable":true},"default_variant_id":{"type":"string"},"thumbnail_url":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"}},"price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"original_price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"primary_media":{"$ref":"#/components/schemas/Media"},"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"}},"variants":{"type":"array","items":{"$ref":"#/components/schemas/Variant"}},"default_variant":{"$ref":"#/components/schemas/Variant"},"option_types":{"type":"array","items":{"$ref":"#/components/schemas/OptionType"}},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"prior_price":{"allOf":[{"$ref":"#/components/schemas/PriceHistory"}],"nullable":true},"translations":{"type":"object"},"status":{"type":"string"},"metadata":{"type":"object"},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"product_type_id":{"type":"string","nullable":true},"tax_category_id":{"type":"string","nullable":true},"collections":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}},"product_publications":{"type":"array","items":{"$ref":"#/components/schemas/ProductPublication"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"product_type":{"$ref":"#/components/schemas/ProductType"}},"required":["id","name","slug","meta_title","meta_description","meta_keywords","variant_count","available_on","preorder_ships_at","purchasable","preorder","in_stock","backorderable","available","description","description_html","default_variant_id","thumbnail_url","tags","price","original_price","status","metadata","deleted_at","created_at","updated_at","delivery_profile_id","product_type_id","tax_category_id"],"x-typelizer":true},"ProductTypeCustomFieldDefinition":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"namespace":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string","enum":["short_text","long_text","rich_text","number","boolean","json"]},"required":{"type":"boolean"},"sort_order":{"type":"number"}},"required":["id","key","namespace","label","field_type","required","sort_order"],"x-typelizer":true},"ProductType":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"translations":{"type":"object"},"products_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivery_profile_id":{"type":"string","nullable":true},"option_type_ids":{"type":"array","items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string"}},"custom_field_definitions":{"type":"array","items":{"$ref":"#/components/schemas/ProductTypeCustomFieldDefinition"}}},"required":["id","name","products_count","created_at","updated_at","delivery_profile_id","option_type_ids","category_ids","custom_field_definitions"],"x-typelizer":true},"PromotionAction":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"promotion_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"calculator":{"allOf":[{"$ref":"#/components/schemas/PromotionActionCalculator"}],"nullable":true},"line_items":{"type":"array","items":{"$ref":"#/components/schemas/PromotionActionLineItem"},"nullable":true}},"required":["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","calculator","line_items"],"x-typelizer":true},"PromotionRule":{"type":"object","properties":{"id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"type":{"type":"string"},"promotion_id":{"type":"string"},"preferences":{"type":"object"},"preference_schema":{"type":"array","items":{"$ref":"#/components/schemas/PreferenceField"}},"label":{"type":"string"},"product_ids":{"type":"array","items":{"type":"string"},"nullable":true},"category_ids":{"type":"array","items":{"type":"string"},"nullable":true},"customer_ids":{"type":"array","items":{"type":"string"},"nullable":true},"products":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"customer_groups":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroup"}},"countries":{"type":"array","items":{"$ref":"#/components/schemas/Country"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},"markets":{"type":"array","items":{"$ref":"#/components/schemas/Market"}}},"required":["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","product_ids","category_ids","customer_ids"],"x-typelizer":true},"Promotion":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"code":{"type":"string","nullable":true},"starts_at":{"type":"string","nullable":true},"expires_at":{"type":"string","nullable":true},"usage_limit":{"type":"number","nullable":true},"match_policy":{"type":"string","enum":["all","any"]},"path":{"type":"string","nullable":true},"kind":{"type":"string","enum":["coupon_code","automatic"]},"multi_codes":{"type":"boolean"},"number_of_codes":{"type":"number","nullable":true},"code_prefix":{"type":"string","nullable":true},"promotion_category_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"action_ids":{"type":"array","items":{"type":"string"}},"rule_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","description","code","starts_at","expires_at","usage_limit","match_policy","path","kind","multi_codes","number_of_codes","code_prefix","promotion_category_id","metadata","created_at","updated_at","action_ids","rule_ids"],"x-typelizer":true},"RefundReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Refund":{"type":"object","properties":{"id":{"type":"string"},"transaction_id":{"type":"string","nullable":true},"amount":{"type":"string","nullable":true},"payment_id":{"type":"string","nullable":true},"refund_reason_id":{"type":"string","nullable":true},"originator_id":{"type":"string","nullable":true},"originator_type":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"payment":{"$ref":"#/components/schemas/Payment"}},"required":["id","transaction_id","amount","payment_id","refund_reason_id","originator_id","originator_type","metadata","created_at","updated_at"],"x-typelizer":true},"ReturnLineItem":{"type":"object","properties":{"id":{"type":"string"},"quantity":{"type":"number"},"received_quantity":{"type":"number"},"resellable":{"type":"boolean"},"pre_tax_amount":{"type":"string"},"display_pre_tax_amount":{"type":"string"},"variant_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_item_id":{"type":"string","nullable":true},"variant":{"$ref":"#/components/schemas/Variant"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"line_item":{"$ref":"#/components/schemas/LineItem"}},"required":["id","quantity","received_quantity","resellable","pre_tax_amount","display_pre_tax_amount","variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":true},"ReturnReason":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"can_be_deleted":{"type":"boolean"}},"required":["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":true},"Return":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"},"order_id":{"type":"string","nullable":true},"reason_id":{"type":"string","nullable":true},"refund_total":{"type":"string"},"display_refund_total":{"type":"string"},"approved_at":{"type":"string","nullable":true},"received_at":{"type":"string","nullable":true},"refunded_at":{"type":"string","nullable":true},"canceled_at":{"type":"string","nullable":true},"reason":{"$ref":"#/components/schemas/ReturnReason"},"return_line_items":{"type":"array","items":{"$ref":"#/components/schemas/ReturnLineItem"}},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"stock_location_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"refunded_total":{"type":"string"},"refundable_total":{"type":"string"},"order":{"$ref":"#/components/schemas/Order"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}}},"required":["id","number","status","order_id","reason_id","refund_total","display_refund_total","approved_at","received_at","refunded_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id","refunded_total","refundable_total"],"x-typelizer":true},"Role":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"permissions":{"type":"array","items":{"type":"string"}},"mutable":{"type":"boolean"},"users_count":{"type":"number"}},"required":["id","name","description","created_at","updated_at","permissions","mutable","users_count"],"x-typelizer":true},"SetupTask":{"type":"object","properties":{"name":{"type":"string"},"done":{"type":"boolean"}},"required":["name","done"],"x-typelizer":true},"State":{"type":"object","properties":{"abbr":{"type":"string"},"name":{"type":"string"}},"required":["abbr","name"],"x-typelizer":true},"StockItem":{"type":"object","properties":{"id":{"type":"string"},"count_on_hand":{"type":"number"},"backorderable":{"type":"boolean"},"stock_location_id":{"type":"string","nullable":true},"variant_id":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"allocated_count":{"type":"number"},"available_count":{"type":"number"},"stock_location":{"$ref":"#/components/schemas/StockLocation"},"variant":{"$ref":"#/components/schemas/Variant"}},"required":["id","count_on_hand","backorderable","stock_location_id","variant_id","metadata","created_at","updated_at","allocated_count","available_count"],"x-typelizer":true},"StockLocation":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"address1":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"zipcode":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"country_name":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"state_text":{"type":"string","nullable":true},"pickup_ready_in_minutes":{"type":"number","nullable":true},"pickup_instructions":{"type":"string","nullable":true},"admin_name":{"type":"string","nullable":true},"address2":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"active":{"type":"boolean"},"default":{"type":"boolean"},"backorderable_default":{"type":"boolean"},"propagate_all_variants":{"type":"boolean"},"kind":{"type":"string"},"pickup_enabled":{"type":"boolean"},"pickup_stock_policy":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","address1","city","zipcode","country_code","country_name","state_code","state_text","pickup_ready_in_minutes","pickup_instructions","admin_name","address2","state_name","phone","company","active","default","backorderable_default","propagate_all_variants","kind","pickup_enabled","pickup_stock_policy","created_at","updated_at"],"x-typelizer":true},"StockReservation":{"type":"object","properties":{"id":{"type":"string"},"stock_item_id":{"type":"string"},"line_item_id":{"type":"string"},"order_id":{"type":"string"},"variant_id":{"type":"string","nullable":true},"stock_location_id":{"type":"string","nullable":true},"quantity":{"type":"number"},"expires_at":{"type":"string"},"active":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","stock_item_id","line_item_id","order_id","variant_id","stock_location_id","quantity","expires_at","active","created_at","updated_at"],"x-typelizer":true},"StockTransfer":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"reference":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"source_location_id":{"type":"string","nullable":true},"destination_location_id":{"type":"string","nullable":true},"source_location":{"$ref":"#/components/schemas/StockLocation"},"destination_location":{"$ref":"#/components/schemas/StockLocation"}},"required":["id","number","reference","metadata","created_at","updated_at","source_location_id","destination_location_id"],"x-typelizer":true},"StoreCreditCategory":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"non_expiring":{"type":"boolean"}},"required":["id","name","created_at","updated_at","non_expiring"],"x-typelizer":true},"StoreCredit":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"string"},"amount_used":{"type":"string"},"amount_remaining":{"type":"string"},"display_amount":{"type":"string"},"display_amount_used":{"type":"string"},"display_amount_remaining":{"type":"string"},"currency":{"type":"string"},"memo":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer_id":{"type":"string","nullable":true},"created_by_id":{"type":"string","nullable":true},"category_id":{"type":"string","nullable":true},"category_name":{"type":"string","nullable":true}},"required":["id","amount","amount_used","amount_remaining","display_amount","display_amount_used","display_amount_remaining","currency","memo","metadata","created_at","updated_at","customer_id","created_by_id","category_id","category_name"],"x-typelizer":true},"Store":{"type":"object","properties":{"id":{"type":"string"},"metadata":{"type":"object"},"name":{"type":"string"},"code":{"type":"string"},"preferred_storefront_url":{"type":"string","nullable":true},"default_currency":{"type":"string"},"default_locale":{"type":"string"},"mail_from_address":{"type":"string","nullable":true},"customer_support_email":{"type":"string","nullable":true},"new_order_notifications_email":{"type":"string","nullable":true},"preferred_send_consumer_transactional_emails":{"type":"boolean"},"preferred_admin_locale":{"type":"string","nullable":true},"preferred_timezone":{"type":"string"},"preferred_weight_unit":{"type":"string"},"preferred_default_package_weight":{"type":"number"},"preferred_default_package_length":{"type":"number"},"preferred_default_package_width":{"type":"number"},"preferred_default_package_height":{"type":"number"},"preferred_unit_system":{"type":"string"},"preferred_storefront_access":{"type":"string"},"preferred_guest_checkout":{"type":"boolean"},"preferred_company_field_enabled":{"type":"boolean"},"preferred_address_requires_company":{"type":"boolean"},"preferred_address_requires_phone":{"type":"boolean"},"preferred_capture_method":{"type":"string"},"preferred_track_inventory_levels":{"type":"boolean"},"preferred_stock_reservations_enabled":{"type":"boolean"},"preferred_track_price_history":{"type":"boolean"},"preferred_show_products_without_price":{"type":"boolean"},"preferred_disable_sku_validation":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string"},"preferred_document_number_format":{"type":"string"},"preferred_order_number_prefix":{"type":"string"},"preferred_order_number_suffix":{"type":"string"},"preferred_order_number_sequence_start":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"order_number_sequence_started":{"type":"boolean"},"url":{"type":"string"},"api_url":{"type":"string"},"setup_tasks":{"type":"array","items":{"$ref":"#/components/schemas/SetupTask"}},"supported_currencies":{"type":"array","items":{"type":"string"}},"supported_locales":{"type":"array","items":{"type":"string"}},"available_locales":{"type":"array","items":{"type":"string"}},"logo_url":{"type":"string","nullable":true},"mailer_logo_url":{"type":"string","nullable":true}},"required":["id","metadata","name","code","preferred_storefront_url","default_currency","default_locale","mail_from_address","customer_support_email","new_order_notifications_email","preferred_send_consumer_transactional_emails","preferred_admin_locale","preferred_timezone","preferred_weight_unit","preferred_default_package_weight","preferred_default_package_length","preferred_default_package_width","preferred_default_package_height","preferred_unit_system","preferred_storefront_access","preferred_guest_checkout","preferred_company_field_enabled","preferred_address_requires_company","preferred_address_requires_phone","preferred_capture_method","preferred_track_inventory_levels","preferred_stock_reservations_enabled","preferred_track_price_history","preferred_show_products_without_price","preferred_disable_sku_validation","preferred_order_routing_strategy","preferred_document_number_format","preferred_order_number_prefix","preferred_order_number_suffix","preferred_order_number_sequence_start","created_at","updated_at","order_number_sequence_started","url","api_url","setup_tasks","supported_currencies","supported_locales","available_locales","logo_url","mailer_logo_url"],"x-typelizer":true},"TaxCategory":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"tax_code":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"is_default":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","tax_code","description","is_default","created_at","updated_at"],"x-typelizer":true},"TaxExemptionCertificate":{"type":"object","properties":{"id":{"type":"string"},"certificate_number":{"type":"string"},"reason_code":{"type":"string"},"status":{"type":"string"},"issuing_authority":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"issued_at":{"type":"string"},"expires_at":{"type":"string"},"verified_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"company_id":{"type":"string"},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"active":{"type":"boolean"},"lapsed":{"type":"boolean"},"can_be_deleted":{"type":"boolean"},"document_filename":{"type":"string","nullable":true},"document_byte_size":{"type":"number","nullable":true},"document_url":{"type":"string","nullable":true}},"required":["id","certificate_number","reason_code","status","issuing_authority","metadata","issued_at","expires_at","verified_at","created_at","updated_at","company_id","country_code","state_code","active","lapsed","can_be_deleted","document_filename","document_byte_size","document_url"],"x-typelizer":true},"TaxIdentifier":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"value":{"type":"string"},"validation_status":{"type":"string","nullable":true},"validation_evidence":{"type":"object","nullable":true},"source":{"type":"string","nullable":true},"validated_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"validatable":{"type":"boolean"},"customer_id":{"type":"string","nullable":true},"cart_id":{"type":"string","nullable":true},"order_id":{"type":"string","nullable":true}},"required":["id","kind","value","validation_status","validation_evidence","source","validated_at","created_at","updated_at","validatable","customer_id","cart_id","order_id"],"x-typelizer":true},"TaxLine":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"included":{"type":"boolean"},"rate":{"type":"string"},"tax_rate_id":{"type":"string","nullable":true},"line_item_id":{"type":"string","nullable":true},"fulfillment_id":{"type":"string","nullable":true},"fee_id":{"type":"string","nullable":true},"amount":{"type":"string"},"display_amount":{"type":"string"},"provider_id":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"taxability_reason":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true},"data":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","label","included","rate","tax_rate_id","line_item_id","fulfillment_id","fee_id","amount","display_amount","provider_id","metadata","taxability_reason","country_code","state_code","data","created_at","updated_at"],"x-typelizer":true},"TaxRate":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"included_in_price":{"type":"boolean"},"show_rate_in_label":{"type":"boolean"},"metadata":{"type":"object","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string","nullable":true},"amount":{"type":"string"},"amount_percentage":{"type":"number","nullable":true},"tax_category_id":{"type":"string","nullable":true},"store_id":{"type":"string","nullable":true},"country_code":{"type":"string","nullable":true},"state_code":{"type":"string","nullable":true}},"required":["id","name","included_in_price","show_rate_in_label","metadata","created_at","updated_at","deleted_at","amount","amount_percentage","tax_category_id","store_id","country_code","state_code"],"x-typelizer":true},"Variant":{"type":"object","properties":{"id":{"type":"string"},"product_id":{"type":"string"},"sku":{"type":"string","nullable":true},"options_text":{"type":"string"},"track_inventory":{"type":"boolean"},"media_count":{"type":"number"},"preorder_ships_at":{"type":"string","nullable":true},"thumbnail_url":{"type":"string","nullable":true},"purchasable":{"type":"boolean"},"in_stock":{"type":"boolean"},"backorderable":{"type":"boolean"},"preorder":{"type":"boolean"},"weight":{"type":"number","nullable":true},"height":{"type":"number","nullable":true},"width":{"type":"number","nullable":true},"depth":{"type":"number","nullable":true},"price":{"$ref":"#/components/schemas/Price"},"original_price":{"allOf":[{"$ref":"#/components/schemas/Price"}],"nullable":true},"primary_media":{"$ref":"#/components/schemas/Media"},"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"}},"option_values":{"type":"array","items":{"$ref":"#/components/schemas/OptionValue"}},"custom_fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}},"prior_price":{"allOf":[{"$ref":"#/components/schemas/PriceHistory"}],"nullable":true},"metadata":{"type":"object"},"position":{"type":"number"},"cost_price":{"type":"string","nullable":true},"cost_currency":{"type":"string","nullable":true},"barcode":{"type":"string","nullable":true},"weight_unit":{"type":"string","nullable":true},"dimensions_unit":{"type":"string","nullable":true},"backorder_limit":{"type":"number","nullable":true},"deleted_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"preorderable":{"type":"boolean"},"tax_category_id":{"type":"string","nullable":true},"available_stock":{"type":"number","nullable":true},"reserved_quantity":{"type":"number"},"total_on_hand":{"type":"number","nullable":true},"product_name":{"type":"string"},"prices":{"type":"array","items":{"$ref":"#/components/schemas/Price"}},"stock_items":{"type":"array","items":{"$ref":"#/components/schemas/StockItem"}}},"required":["id","product_id","sku","options_text","track_inventory","media_count","preorder_ships_at","thumbnail_url","purchasable","in_stock","backorderable","preorder","weight","height","width","depth","price","original_price","option_values","metadata","position","cost_price","cost_currency","barcode","weight_unit","dimensions_unit","backorder_limit","deleted_at","created_at","updated_at","preorderable","tax_category_id","available_stock","reserved_quantity","total_on_hand","product_name"],"x-typelizer":true},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string"},"event_name":{"type":"string"},"event_id":{"type":"string","nullable":true},"response_code":{"type":"number","nullable":true},"execution_time":{"type":"number","nullable":true},"error_type":{"type":"string","nullable":true},"request_errors":{"type":"string","nullable":true},"response_body":{"type":"string","nullable":true},"success":{"type":"boolean","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"delivered_at":{"type":"string","nullable":true},"payload":{"type":"object"},"webhook_endpoint_id":{"type":"string"},"webhook_endpoint_url":{"type":"string"}},"required":["id","event_name","event_id","response_code","execution_time","error_type","request_errors","response_body","success","created_at","updated_at","delivered_at","payload","webhook_endpoint_id","webhook_endpoint_url"],"x-typelizer":true},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true},"url":{"type":"string"},"active":{"type":"boolean"},"subscriptions":{"type":"array","items":{"type":"string"}},"disabled_reason":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"disabled_at":{"type":"string","nullable":true},"secret_key":{"type":"string","nullable":true},"last_delivery_at":{"type":"string","nullable":true},"recent_delivery_count":{"type":"number"},"recent_failure_count":{"type":"number"},"total_delivery_count":{"type":"number"},"successful_delivery_count":{"type":"number"},"failed_delivery_count":{"type":"number"}},"required":["id","name","url","active","subscriptions","disabled_reason","created_at","updated_at","disabled_at","secret_key","last_delivery_at","recent_delivery_count","recent_failure_count","total_delivery_count","successful_delivery_count","failed_delivery_count"],"x-typelizer":true}}}}
\ No newline at end of file
diff --git a/packages/dashboard-core/src/components/address-form-dialog.tsx b/packages/dashboard-core/src/components/address-form-dialog.tsx
index 5ac17c2079..4f92e38d0b 100644
--- a/packages/dashboard-core/src/components/address-form-dialog.tsx
+++ b/packages/dashboard-core/src/components/address-form-dialog.tsx
@@ -31,7 +31,7 @@ export interface AddressParams {
address2: string
city: string
postal_code: string
- country_iso: string
+ country_code: string
state_code: string
phone: string
label?: string
@@ -61,10 +61,10 @@ const addressFormSchema = z.object({
.string()
.trim()
.min(1, { error: requiredMessage('address.postal_code') }),
- country_iso: z
+ country_code: z
.string()
.trim()
- .min(1, { error: requiredMessage('country_iso') }),
+ .min(1, { error: requiredMessage('country_code') }),
state_code: z.string(),
phone: z.string(),
label: z.string(),
@@ -82,7 +82,7 @@ function buildDefaults(address: Address | null | undefined): AddressFormValues {
address2: address?.address2 ?? '',
city: address?.city ?? '',
postal_code: address?.postal_code ?? '',
- country_iso: address?.country_iso ?? '',
+ country_code: address?.country_code ?? '',
state_code: address?.state_code ?? '',
phone: address?.phone ?? '',
label: address?.label ?? '',
@@ -131,8 +131,8 @@ export function AddressFormDialog({
}
}, [address, form])
- const countryIso = form.watch('country_iso')
- const { states, statesRequired } = useCountryStates(countryIso)
+ const countryCode = form.watch('country_code')
+ const { states, statesRequired } = useCountryStates(countryCode)
const useStateCombobox = statesRequired && states.length > 0
async function onSubmit(values: AddressFormValues) {
@@ -144,7 +144,7 @@ export function AddressFormDialog({
address2: values.address2,
city: values.city,
postal_code: values.postal_code,
- country_iso: values.country_iso,
+ country_code: values.country_code,
state_code: values.state_code,
phone: values.phone,
...(showLabel && { label: values.label || undefined }),
@@ -242,9 +242,9 @@ export function AddressFormDialog({
<FieldError errors={[errors.address2]} />
</Field>
<Field>
- <FieldLabel>{t('admin.fields.country_iso.label')}</FieldLabel>
+ <FieldLabel>{t('admin.fields.country_code.label')}</FieldLabel>
<Controller
- name="country_iso"
+ name="country_code"
control={form.control}
render={({ field }) => (
<CountryCombobox
@@ -256,7 +256,7 @@ export function AddressFormDialog({
/>
)}
/>
- <FieldError errors={[errors.country_iso]} />
+ <FieldError errors={[errors.country_code]} />
</Field>
<div className="grid grid-cols-2 gap-3">
<Field>
@@ -276,7 +276,7 @@ export function AddressFormDialog({
control={form.control}
render={({ field }) => (
<StateCombobox
- countryIso={countryIso}
+ countryCode={countryCode}
states={states}
value={field.value}
onValueChange={field.onChange}
diff --git a/packages/dashboard-core/src/components/country-state-fields.tsx b/packages/dashboard-core/src/components/country-state-fields.tsx
index acf470bbe4..3d016b0c6e 100644
--- a/packages/dashboard-core/src/components/country-state-fields.tsx
+++ b/packages/dashboard-core/src/components/country-state-fields.tsx
@@ -18,11 +18,11 @@ type StateOption = { abbr: string; name: string }
* when the country doesn't enumerate them (free-text region); `statesRequired`
* tells callers whether to fall back to a plain text input.
*/
-export function useCountryStates(countryIso: string | null | undefined) {
+export function useCountryStates(countryCode: string | null | undefined) {
const { countries } = useCountries()
const country = useMemo(
- () => countries.find((c) => c.iso === countryIso) ?? null,
- [countries, countryIso],
+ () => countries.find((c) => c.iso === countryCode) ?? null,
+ [countries, countryCode],
)
return {
states: ((country?.states ?? []) as StateOption[]).filter((s) => Boolean(s.abbr)),
@@ -35,18 +35,18 @@ export function useCountryStates(countryIso: string | null | undefined) {
* abbreviation (e.g. "CA"). Callers should hide this and render a free-text
* Input when `useCountryStates(...).states` is empty.
*
- * Keyed on `countryIso` so the internal state is reset when the country
+ * Keyed on `countryCode` so the internal state is reset when the country
* changes — prevents a stale highlight from a previous country.
*/
export function StateCombobox({
- countryIso,
+ countryCode,
states,
value,
onValueChange,
placeholder,
disabled = false,
}: {
- countryIso: string | null | undefined
+ countryCode: string | null | undefined
/** State list for the active country (typically from `useCountryStates`). */
states: Pick<State, 'abbr' | 'name'>[]
value: string | null | undefined
@@ -60,7 +60,7 @@ export function StateCombobox({
return (
<Combobox
- key={countryIso ?? 'no-country'}
+ key={countryCode ?? 'no-country'}
items={items}
value={selected}
onValueChange={(s: StateOption | null) => onValueChange(s?.abbr ?? '')}
diff --git a/packages/dashboard-core/src/locales/ar.json b/packages/dashboard-core/src/locales/ar.json
index 0b6b1c7fb2..80c7521a59 100644
--- a/packages/dashboard-core/src/locales/ar.json
+++ b/packages/dashboard-core/src/locales/ar.json
@@ -251,7 +251,7 @@
"zipcode": {
"label": "الرمز البريدي"
},
- "country_iso": {
+ "country_code": {
"label": "البلد"
},
"state_code": {
diff --git a/packages/dashboard-core/src/locales/de.json b/packages/dashboard-core/src/locales/de.json
index ca68d6321f..260f1df674 100644
--- a/packages/dashboard-core/src/locales/de.json
+++ b/packages/dashboard-core/src/locales/de.json
@@ -251,7 +251,7 @@
"zipcode": {
"label": "Postleitzahl"
},
- "country_iso": {
+ "country_code": {
"label": "Land"
},
"state_code": {
diff --git a/packages/dashboard-core/src/locales/en.json b/packages/dashboard-core/src/locales/en.json
index 60c4771f5d..ba1eb105ce 100644
--- a/packages/dashboard-core/src/locales/en.json
+++ b/packages/dashboard-core/src/locales/en.json
@@ -251,7 +251,7 @@
"zipcode": {
"label": "Postal code"
},
- "country_iso": {
+ "country_code": {
"label": "Country"
},
"state_code": {
diff --git a/packages/dashboard-core/src/locales/fr.json b/packages/dashboard-core/src/locales/fr.json
index 983d485643..96a0de1562 100644
--- a/packages/dashboard-core/src/locales/fr.json
+++ b/packages/dashboard-core/src/locales/fr.json
@@ -251,7 +251,7 @@
"zipcode": {
"label": "Code postal"
},
- "country_iso": {
+ "country_code": {
"label": "Pays"
},
"state_code": {
diff --git a/packages/dashboard-core/src/locales/pl.json b/packages/dashboard-core/src/locales/pl.json
index c6a3257b97..d73535ad9e 100644
--- a/packages/dashboard-core/src/locales/pl.json
+++ b/packages/dashboard-core/src/locales/pl.json
@@ -251,7 +251,7 @@
"zipcode": {
"label": "Kod pocztowy"
},
- "country_iso": {
+ "country_code": {
"label": "Kraj"
},
"state_code": {
diff --git a/packages/dashboard-core/src/locales/zh-CN.json b/packages/dashboard-core/src/locales/zh-CN.json
index dcb6af5bec..63f228dcd4 100644
--- a/packages/dashboard-core/src/locales/zh-CN.json
+++ b/packages/dashboard-core/src/locales/zh-CN.json
@@ -251,7 +251,7 @@
"zipcode": {
"label": "邮政编码"
},
- "country_iso": {
+ "country_code": {
"label": "国家/地区"
},
"state_code": {
diff --git a/packages/dashboard-ui/src/spree/address-block.tsx b/packages/dashboard-ui/src/spree/address-block.tsx
index 5ae3b08022..164a940b24 100644
--- a/packages/dashboard-ui/src/spree/address-block.tsx
+++ b/packages/dashboard-ui/src/spree/address-block.tsx
@@ -13,7 +13,7 @@ export interface AddressBlockValue {
city?: string | null
state_text?: string | null
postal_code?: string | null
- country_iso?: string | null
+ country_code?: string | null
country_name?: string | null
phone?: string | null
}
@@ -60,7 +60,7 @@ export function AddressBlock({
{[address.city, address.state_text, address.postal_code].filter(Boolean).join(', ')}
</div>
<div>
- {localizedCountryName(i18n.language, address.country_iso, address.country_name)}
+ {localizedCountryName(i18n.language, address.country_code, address.country_name)}
</div>
{address.phone && <div>{address.phone}</div>}
</div>
diff --git a/packages/dashboard/e2e/markets.spec.ts b/packages/dashboard/e2e/markets.spec.ts
index 0553824264..df6e3aeed5 100644
--- a/packages/dashboard/e2e/markets.spec.ts
+++ b/packages/dashboard/e2e/markets.spec.ts
@@ -55,7 +55,7 @@ async function addSupportedLocale(page: Page, { search, label }: LocalePick) {
}
// The seeded default store creates a default market for `US` via
-// `Store#ensure_default_market` (anchored to `default_country_iso = 'US'`),
+// `Store#ensure_default_market` (anchored to `default_country_code = 'US'`),
// plus a EUR market anchored to `Germany` (so the store is multi-currency —
// see `global-setup.ts`). `Spree::MarketCountry#country_unique_per_store`
// rejects re-assigning a country to a second market in the same store, so
diff --git a/packages/dashboard/src/components/spree/company-location-sheet.tsx b/packages/dashboard/src/components/spree/company-location-sheet.tsx
index bf7eeebd3a..392d776a3b 100644
--- a/packages/dashboard/src/components/spree/company-location-sheet.tsx
+++ b/packages/dashboard/src/components/spree/company-location-sheet.tsx
@@ -209,7 +209,7 @@ function addressToForm(address: CompanyLocation['billing_address'] | undefined)
city: address?.city ?? '',
postal_code: address?.postal_code ?? '',
phone: address?.phone ?? '',
- country_iso: address?.country_iso ?? '',
+ country_code: address?.country_code ?? '',
state_code: address?.state_code ?? '',
}
}
@@ -224,8 +224,8 @@ function AddressFieldset({
legend: string
}) {
const { t } = useTranslation()
- const countryIso = form.watch(`${prefix}.country_iso`)
- const { states } = useCountryStates(countryIso)
+ const countryCode = form.watch(`${prefix}.country_code`)
+ const { states } = useCountryStates(countryCode)
return (
<fieldset className="flex flex-col gap-4 rounded-md border p-4">
@@ -273,7 +273,7 @@ function AddressFieldset({
<Field>
<FieldLabel htmlFor={`${prefix}-country`}>{t('admin.fields.country.label')}</FieldLabel>
<Controller
- name={`${prefix}.country_iso`}
+ name={`${prefix}.country_code`}
control={form.control}
render={({ field }) => (
<CountryCombobox
@@ -286,7 +286,7 @@ function AddressFieldset({
)}
/>
</Field>
- {countryIso && states.length > 0 && (
+ {countryCode && states.length > 0 && (
<Field>
<FieldLabel htmlFor={`${prefix}-state`}>{t('admin.fields.state.label')}</FieldLabel>
<Controller
@@ -294,7 +294,7 @@ function AddressFieldset({
control={form.control}
render={({ field }) => (
<StateCombobox
- countryIso={countryIso}
+ countryCode={countryCode}
states={states}
value={field.value}
onValueChange={field.onChange}
diff --git a/packages/dashboard/src/components/spree/jurisdiction-label.tsx b/packages/dashboard/src/components/spree/jurisdiction-label.tsx
index 094f5d1bb6..619d28a66b 100644
--- a/packages/dashboard/src/components/spree/jurisdiction-label.tsx
+++ b/packages/dashboard/src/components/spree/jurisdiction-label.tsx
@@ -8,17 +8,17 @@ import { useTranslation } from 'react-i18next'
* worldwide scope, never as a dash.
*/
export function JurisdictionLabel({
- countryIso,
+ countryCode,
stateCode,
}: {
- countryIso?: string | null
+ countryCode?: string | null
stateCode?: string | null
}) {
const { t } = useTranslation()
const regionName = useDisplayName('region')
- if (!countryIso) return <>{t('admin.jurisdiction.everywhere')}</>
+ if (!countryCode) return <>{t('admin.jurisdiction.everywhere')}</>
- const country = regionName(countryIso) ?? countryIso
+ const country = regionName(countryCode) ?? countryCode
return <>{stateCode ? `${country} — ${stateCode}` : country}</>
}
diff --git a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
index 1c2bda5fd0..d005892921 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
@@ -828,9 +828,9 @@ function RuleSummary({ draft }: { draft: PromotionRuleFormDraft }) {
const RULE_PREFS_SHOWN_ELSEWHERE = new Set([
'match_policy', // shown in the rules card header
'customer_group_ids', // surfaced via `customer_groups` records
- 'country_isos', // surfaced via `countries` records
+ 'country_codes', // surfaced via `countries` records
'country_id',
- 'country_iso',
+ 'country_code',
'channel_ids', // surfaced via `channels` records
'market_ids', // surfaced via `markets` records
])
diff --git a/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx b/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx
index ddbf523839..f194fd70eb 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx
@@ -9,7 +9,7 @@ import type { PromotionRuleEditorContext } from './types'
* Multi-select country picker for the promotion Country rule.
*
* Stores ISO codes — the `Country` resource has no numeric id, so its
- * primary key is `iso`. The rule's `country_isos` preference and the
+ * primary key is `iso`. The rule's `country_codes` preference and the
* display-only `countries` records are both derived from the selected
* ISO set on save. The picker UI lives in the shared
* `<CountryMultiCombobox>` so it stays consistent with the address-form
@@ -19,24 +19,24 @@ export function CountryRuleEditor({ draft, onSave, onClose }: PromotionRuleEdito
const { t } = useTranslation()
const { countries } = useCountries()
- const [countryIsos, setCountryIsos] = useState<string[]>(() =>
- ((draft.preferences?.country_isos ?? []) as string[]).map((s) => s.toUpperCase()),
+ const [countryCodes, setCountryCodes] = useState<string[]>(() =>
+ ((draft.preferences?.country_codes ?? []) as string[]).map((s) => s.toUpperCase()),
)
// Display-only `countries` records for the rule summary — derived from the
// cached list, stripped at payload time.
const selectedCountries = useMemo<Country[]>(
() =>
- countryIsos
+ countryCodes
.map((iso) => countries.find((c) => c.iso === iso))
.filter((c): c is Country => Boolean(c)),
- [countryIsos, countries],
+ [countryCodes, countries],
)
function handleSave() {
onSave({
...draft,
- preferences: { ...draft.preferences, country_isos: countryIsos },
+ preferences: { ...draft.preferences, country_codes: countryCodes },
countries: selectedCountries,
})
onClose()
@@ -47,7 +47,7 @@ export function CountryRuleEditor({ draft, onSave, onClose }: PromotionRuleEdito
<FieldGroup>
<Field>
<FieldLabel>{t('admin.promotions.rules.country.label')}</FieldLabel>
- <CountryMultiCombobox value={countryIsos} onValueChange={setCountryIsos} />
+ <CountryMultiCombobox value={countryCodes} onValueChange={setCountryCodes} />
</Field>
</FieldGroup>
</EditorShell>
diff --git a/packages/dashboard/src/components/spree/shipping/delivery-zone-region-picker.tsx b/packages/dashboard/src/components/spree/shipping/delivery-zone-region-picker.tsx
index 29591225f7..c5fda67313 100644
--- a/packages/dashboard/src/components/spree/shipping/delivery-zone-region-picker.tsx
+++ b/packages/dashboard/src/components/spree/shipping/delivery-zone-region-picker.tsx
@@ -411,8 +411,8 @@ function PostalRulesSection({
<div className="flex items-center gap-2">
<Select
items={countryOptions}
- value={rule.country_iso ?? ''}
- onValueChange={(next) => update(index, { country_iso: next as string })}
+ value={rule.country_code ?? ''}
+ onValueChange={(next) => update(index, { country_code: next as string })}
>
<SelectTrigger className="flex-1">
<SelectValue>
@@ -474,7 +474,7 @@ function PostalRulesSection({
...rules,
{
member_type: 'postal_code',
- country_iso: countryOptions[0]?.value ?? '',
+ country_code: countryOptions[0]?.value ?? '',
postal_code_prefix: '',
postal_code_from: '',
postal_code_to: '',
diff --git a/packages/dashboard/src/components/spree/shipping/delivery-zone-selection.test.ts b/packages/dashboard/src/components/spree/shipping/delivery-zone-selection.test.ts
index 0aa32efeb8..710f50328e 100644
--- a/packages/dashboard/src/components/spree/shipping/delivery-zone-selection.test.ts
+++ b/packages/dashboard/src/components/spree/shipping/delivery-zone-selection.test.ts
@@ -16,10 +16,10 @@ function zone(members: Partial<DeliveryZoneMember>[]): DeliveryZone {
describe('readSelection', () => {
it('splits members into whole countries, states and postal rules', () => {
const selection = readSelection([
- { member_type: 'country', country_iso: 'DE' },
- { member_type: 'state', country_iso: 'US', state_code: 'CA' },
- { member_type: 'state', country_iso: 'US', state_code: 'NY' },
- { member_type: 'postal_code', country_iso: 'FR', postal_code_prefix: '75' },
+ { member_type: 'country', country_code: 'DE' },
+ { member_type: 'state', country_code: 'US', state_code: 'CA' },
+ { member_type: 'state', country_code: 'US', state_code: 'NY' },
+ { member_type: 'postal_code', country_code: 'FR', postal_code_prefix: '75' },
])
expect([...selection.countries]).toEqual(['DE'])
@@ -29,8 +29,8 @@ describe('readSelection', () => {
it('ignores members missing the fields that give them meaning', () => {
const selection = readSelection([
- { member_type: 'country', country_iso: '' },
- { member_type: 'state', country_iso: 'US', state_code: '' },
+ { member_type: 'country', country_code: '' },
+ { member_type: 'state', country_code: 'US', state_code: '' },
])
expect(selection.countries.size).toBe(0)
@@ -41,9 +41,9 @@ describe('readSelection', () => {
describe('writeSelection', () => {
it('round-trips a selection back into the flat member list', () => {
const members: DeliveryZoneMemberValues[] = [
- { member_type: 'country', country_iso: 'DE' },
- { member_type: 'state', country_iso: 'US', state_code: 'CA' },
- { member_type: 'postal_code', country_iso: 'FR', postal_code_prefix: '75' },
+ { member_type: 'country', country_code: 'DE' },
+ { member_type: 'state', country_code: 'US', state_code: 'CA' },
+ { member_type: 'postal_code', country_code: 'FR', postal_code_prefix: '75' },
]
expect(writeSelection(readSelection(members))).toEqual(members)
@@ -53,7 +53,7 @@ describe('writeSelection', () => {
const members = writeSelection({
countries: new Set(['US', 'DE']),
states: new Map([['CA', new Set(['ON'])]]),
- postalRules: [{ member_type: 'postal_code', country_iso: 'FR', postal_code_prefix: '75' }],
+ postalRules: [{ member_type: 'postal_code', country_code: 'FR', postal_code_prefix: '75' }],
})
expect(members.map((member) => member.member_type)).toEqual([
@@ -63,17 +63,17 @@ describe('writeSelection', () => {
'postal_code',
])
// Countries are emitted in ISO order so a saved zone reads consistently.
- expect(members[0].country_iso).toBe('DE')
- expect(members[1].country_iso).toBe('US')
+ expect(members[0].country_code).toBe('DE')
+ expect(members[1].country_code).toBe('US')
})
})
describe('supersedeCountry', () => {
it('drops the states and postal rules a whole country makes redundant', () => {
const selection = readSelection([
- { member_type: 'state', country_iso: 'US', state_code: 'NY' },
- { member_type: 'postal_code', country_iso: 'US', postal_code_prefix: '10' },
- { member_type: 'postal_code', country_iso: 'DE', postal_code_prefix: '10' },
+ { member_type: 'state', country_code: 'US', state_code: 'NY' },
+ { member_type: 'postal_code', country_code: 'US', postal_code_prefix: '10' },
+ { member_type: 'postal_code', country_code: 'DE', postal_code_prefix: '10' },
])
const next = supersedeCountry(selection, 'US')
@@ -81,7 +81,7 @@ describe('supersedeCountry', () => {
expect([...next.countries]).toEqual(['US'])
expect(next.states.has('US')).toBe(false)
// Germany's rule is untouched — only the superseded country is cleaned up.
- expect(next.postalRules.map((rule: DeliveryZoneMemberValues) => rule.country_iso)).toEqual([
+ expect(next.postalRules.map((rule: DeliveryZoneMemberValues) => rule.country_code)).toEqual([
'DE',
])
})
@@ -91,10 +91,10 @@ describe('claimedByOtherZones', () => {
it('collects the countries and states sibling zones already cover', () => {
const claimed = claimedByOtherZones([
zone([
- { member_type: 'country', country_iso: 'DE' },
- { member_type: 'state', country_iso: 'US', state_code: 'CA' },
+ { member_type: 'country', country_code: 'DE' },
+ { member_type: 'state', country_code: 'US', state_code: 'CA' },
]),
- zone([{ member_type: 'country', country_iso: 'FR' }]),
+ zone([{ member_type: 'country', country_code: 'FR' }]),
])
expect([...claimed.countries].sort()).toEqual(['DE', 'FR'])
diff --git a/packages/dashboard/src/components/spree/shipping/delivery-zone-selection.ts b/packages/dashboard/src/components/spree/shipping/delivery-zone-selection.ts
index d1bd38c761..cf38b7b8dd 100644
--- a/packages/dashboard/src/components/spree/shipping/delivery-zone-selection.ts
+++ b/packages/dashboard/src/components/spree/shipping/delivery-zone-selection.ts
@@ -31,12 +31,12 @@ export function readSelection(members: DeliveryZoneMemberValues[]): Selection {
const postalRules: DeliveryZoneMemberValues[] = []
for (const member of members) {
- if (member.member_type === 'country' && member.country_iso) {
- countries.add(member.country_iso)
- } else if (member.member_type === 'state' && member.country_iso && member.state_code) {
- const forCountry = states.get(member.country_iso) ?? new Set<string>()
+ if (member.member_type === 'country' && member.country_code) {
+ countries.add(member.country_code)
+ } else if (member.member_type === 'state' && member.country_code && member.state_code) {
+ const forCountry = states.get(member.country_code) ?? new Set<string>()
forCountry.add(member.state_code)
- states.set(member.country_iso, forCountry)
+ states.set(member.country_code, forCountry)
} else if (member.member_type === 'postal_code') {
postalRules.push(member)
}
@@ -53,14 +53,14 @@ export function writeSelection(selection: Selection): DeliveryZoneMemberValues[]
const members: DeliveryZoneMemberValues[] = []
for (const iso of [...selection.countries].sort()) {
- members.push({ member_type: 'country', country_iso: iso })
+ members.push({ member_type: 'country', country_code: iso })
}
for (const [iso, abbrs] of [...selection.states.entries()].sort(([left], [right]) =>
left.localeCompare(right),
)) {
for (const abbr of [...abbrs].sort()) {
- members.push({ member_type: 'state', country_iso: iso, state_code: abbr })
+ members.push({ member_type: 'state', country_code: iso, state_code: abbr })
}
}
@@ -84,7 +84,7 @@ export function supersedeCountry(selection: Selection, iso: string): Selection {
return {
countries,
states,
- postalRules: selection.postalRules.filter((rule) => rule.country_iso !== iso),
+ postalRules: selection.postalRules.filter((rule) => rule.country_code !== iso),
}
}
@@ -94,13 +94,13 @@ export function claimedByOtherZones(siblingZones: DeliveryZone[]) {
for (const zone of siblingZones) {
for (const member of zone.members ?? []) {
- if (!member.country_iso) continue
+ if (!member.country_code) continue
if (member.member_type === 'country') {
- countries.add(member.country_iso)
+ countries.add(member.country_code)
} else if (member.member_type === 'state' && member.state_code) {
- const forCountry = states.get(member.country_iso) ?? new Set<string>()
+ const forCountry = states.get(member.country_code) ?? new Set<string>()
forCountry.add(member.state_code)
- states.set(member.country_iso, forCountry)
+ states.set(member.country_code, forCountry)
}
}
}
diff --git a/packages/dashboard/src/components/spree/shipping/delivery-zone-sheet.tsx b/packages/dashboard/src/components/spree/shipping/delivery-zone-sheet.tsx
index 43e0f2b4f1..6957f7e71d 100644
--- a/packages/dashboard/src/components/spree/shipping/delivery-zone-sheet.tsx
+++ b/packages/dashboard/src/components/spree/shipping/delivery-zone-sheet.tsx
@@ -88,7 +88,7 @@ export function DeliveryZoneSheet({
// up empty and saving would wipe the zone's real coverage.
members: (zone.members ?? []).map((member) => ({
member_type: member.member_type as DeliveryZoneFormValues['members'][number]['member_type'],
- country_iso: member.country_iso ?? '',
+ country_code: member.country_code ?? '',
state_code: member.state_code ?? '',
postal_code_prefix: member.postal_code_prefix ?? '',
postal_code_from: member.postal_code_from ?? '',
diff --git a/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx b/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx
index 8f9723bd44..4b37833826 100644
--- a/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx
+++ b/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx
@@ -205,7 +205,7 @@ export function TaxExemptionCertificatesCard({
})}
{' · '}
<JurisdictionLabel
- countryIso={certificate.country_iso}
+ countryCode={certificate.country_code}
stateCode={certificate.state_code}
/>
</span>
@@ -346,8 +346,8 @@ function CertificateSheet({
if (open) form.reset(TAX_EXEMPTION_CERTIFICATE_DEFAULTS)
}, [open, form])
- const countryIso = form.watch('country_iso')
- const { states } = useCountryStates(countryIso)
+ const countryCode = form.watch('country_code')
+ const { states } = useCountryStates(countryCode)
async function handleSubmit(values: TaxExemptionCertificateFormValues) {
try {
@@ -447,7 +447,7 @@ function CertificateSheet({
{t('admin.fields.country.label')}
</FieldLabel>
<Controller
- name="country_iso"
+ name="country_code"
control={form.control}
render={({ field }) => (
<CountryCombobox
@@ -461,11 +461,11 @@ function CertificateSheet({
)}
/>
<FieldDescription>
- {t('admin.fields.tax_exemption_certificate.country_iso.help')}
+ {t('admin.fields.tax_exemption_certificate.country_code.help')}
</FieldDescription>
</Field>
- {countryIso && states.length > 0 && (
+ {countryCode && states.length > 0 && (
<Field>
<FieldLabel htmlFor="certificate-state">
{t('admin.fields.state.label')}
@@ -475,7 +475,7 @@ function CertificateSheet({
control={form.control}
render={({ field }) => (
<StateCombobox
- countryIso={countryIso}
+ countryCode={countryCode}
states={states}
value={field.value}
onValueChange={field.onChange}
diff --git a/packages/dashboard/src/lib/packing-slip.ts b/packages/dashboard/src/lib/packing-slip.ts
index 0c47abab27..00670f34e3 100644
--- a/packages/dashboard/src/lib/packing-slip.ts
+++ b/packages/dashboard/src/lib/packing-slip.ts
@@ -22,7 +22,7 @@ function addressBlock(order: Order): string {
[address.city, address.state_name ?? address.state_code, address.postal_code]
.filter(Boolean)
.join(', '),
- address.country_name || address.country_iso,
+ address.country_name || address.country_code,
]
.filter(Boolean)
.map((line) => escapeHtml(String(line)))
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index c0e2653097..87963d18c5 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -873,7 +873,7 @@
}
},
"market": {
- "country_isos": {
+ "country_codes": {
"help": "اختر الدول التي يغطيها هذا السوق. كل دولة يمكن أن تنتمي إلى سوق واحد فقط لكل متجر.",
"label": "الدول"
},
@@ -1570,7 +1570,7 @@
"jurisdiction": {
"label": "تسري على"
},
- "country_iso": {
+ "country_code": {
"help": "اتركه فارغاً لفرض الضريبة على كل الدول."
},
"state_code": {
@@ -1591,7 +1591,7 @@
}
},
"tax_exemption_certificate": {
- "country_iso": {
+ "country_code": {
"help": "اتركه فارغاً لشهادة تسري في كل المناطق."
},
"expires_at": {
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index 3790305b4a..ea5dde31dc 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -862,7 +862,7 @@
}
},
"market": {
- "country_isos": {
+ "country_codes": {
"help": "Wählen Sie die Länder aus, die dieser Markt abdeckt. Jedes Land kann pro Store höchstens einem Markt angehören.",
"label": "Länder"
},
@@ -1559,7 +1559,7 @@
"jurisdiction": {
"label": "Gilt für"
},
- "country_iso": {
+ "country_code": {
"help": "Leer lassen, um jedes Land zu besteuern."
},
"state_code": {
@@ -1580,7 +1580,7 @@
}
},
"tax_exemption_certificate": {
- "country_iso": {
+ "country_code": {
"help": "Leer lassen für eine Bescheinigung, die überall gilt."
},
"expires_at": {
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index 563821f838..af75c5b53b 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -862,7 +862,7 @@
}
},
"market": {
- "country_isos": {
+ "country_codes": {
"help": "Pick the countries this market covers. Each country can belong to at most one market per store.",
"label": "Countries"
},
@@ -1559,7 +1559,7 @@
"jurisdiction": {
"label": "Applies to"
},
- "country_iso": {
+ "country_code": {
"help": "Leave empty to tax every country."
},
"state_code": {
@@ -1580,7 +1580,7 @@
}
},
"tax_exemption_certificate": {
- "country_iso": {
+ "country_code": {
"help": "Leave empty for a certificate that holds everywhere."
},
"expires_at": {
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index b3b388ef81..b16b2fce7b 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -862,7 +862,7 @@
}
},
"market": {
- "country_isos": {
+ "country_codes": {
"help": "Choisissez les pays couverts par ce marché. Chaque pays ne peut appartenir qu'à un seul marché par boutique.",
"label": "Pays"
},
@@ -1559,7 +1559,7 @@
"jurisdiction": {
"label": "S'applique à"
},
- "country_iso": {
+ "country_code": {
"help": "Laissez vide pour taxer tous les pays."
},
"state_code": {
@@ -1580,7 +1580,7 @@
}
},
"tax_exemption_certificate": {
- "country_iso": {
+ "country_code": {
"help": "Laissez vide pour une attestation valable partout."
},
"expires_at": {
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index e4b054aa30..0fa2e79bae 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -876,7 +876,7 @@
}
},
"market": {
- "country_isos": {
+ "country_codes": {
"help": "Wybierz kraje obejmowane przez ten rynek. Każdy kraj może należeć do co najwyżej jednego rynku w obrębie sklepu.",
"label": "Kraje"
},
@@ -1573,7 +1573,7 @@
"jurisdiction": {
"label": "Obowiązuje dla"
},
- "country_iso": {
+ "country_code": {
"help": "Zostaw puste, aby opodatkować każdy kraj."
},
"state_code": {
@@ -1594,7 +1594,7 @@
}
},
"tax_exemption_certificate": {
- "country_iso": {
+ "country_code": {
"help": "Zostaw puste, aby certyfikat obowiązywał wszędzie."
},
"expires_at": {
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index e8c6695caf..de56e7ff5e 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -859,7 +859,7 @@
}
},
"market": {
- "country_isos": {
+ "country_codes": {
"help": "选择此市场涵盖的国家/地区。每个国家/地区在每个商店中最多只能属于一个市场。",
"label": "国家/地区"
},
@@ -1556,7 +1556,7 @@
"jurisdiction": {
"label": "适用范围"
},
- "country_iso": {
+ "country_code": {
"help": "留空表示对所有国家征税。"
},
"state_code": {
@@ -1577,7 +1577,7 @@
}
},
"tax_exemption_certificate": {
- "country_iso": {
+ "country_code": {
"help": "留空表示该证明在所有地区有效。"
},
"expires_at": {
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
index 5a4b26f787..a277df6258 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
@@ -153,7 +153,7 @@ function CustomerBody({ customer }: { customer: Customer }) {
const lastCompletedOrder = orders.find((o) => o.status === 'complete')
const defaultShipping = customer.addresses?.find((a) => a.is_default_shipping)
- const location = [defaultShipping?.city, defaultShipping?.country_iso].filter(Boolean).join(', ')
+ const location = [defaultShipping?.city, defaultShipping?.country_code].filter(Boolean).join(', ')
// The server hard-deletes only when the customer has no completed orders
// (Spree::Core::DestroyWithOrdersError → 422 `customer_has_orders`). We
@@ -969,7 +969,7 @@ function AddressesCard({ customer }: { customer: Customer }) {
{addr.address2 && <div className="text-muted-foreground">{addr.address2}</div>}
<div className="text-muted-foreground">
{[addr.city, addr.state_code, addr.postal_code].filter(Boolean).join(', ')} ·{' '}
- {addr.country_iso}
+ {addr.country_code}
</div>
{addr.phone && <div className="text-muted-foreground">{addr.phone}</div>}
</div>
@@ -1082,7 +1082,7 @@ function CustomerAddressDialog({
}
// Wait for countries before mounting so the country/state lazy initializer
- // can resolve the address's country_iso/state_code to a real option.
+ // can resolve the address's country_code/state_code to a real option.
if (countriesLoading) return null
return (
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsx
index e6e401aa7e..42c190b326 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsx
@@ -977,7 +977,7 @@ function ZoneMembersSummary({ zone }: { zone: DeliveryZone }) {
const names = useMemo(() => {
const members = zone.members ?? []
const label = (member: DeliveryZoneMember): string | null => {
- if (member.member_type === 'country') return member.country_name ?? member.country_iso
+ if (member.member_type === 'country') return member.country_name ?? member.country_code
if (member.member_type === 'state') return member.state_name ?? member.state_code
if (member.postal_code_prefix) return `${member.postal_code_prefix}*`
if (member.postal_code_from && member.postal_code_to) {
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
index c84fd788e9..d573669b11 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
@@ -251,7 +251,7 @@ function EditMarketSheet({
supported_locales: market.supported_locales.filter((l) => l !== market.default_locale),
tax_inclusive: market.tax_inclusive,
default: market.default,
- country_isos: market.country_isos,
+ country_codes: market.country_codes,
tax_provider: market.tax_provider ?? '',
})
}
@@ -403,19 +403,19 @@ function MarketFormFields({ form }: { form: UseFormReturn<MarketFormValues> }) {
<Field>
<FieldLabel htmlFor="market-countries">
- {t('admin.fields.market.country_isos.label')}
+ {t('admin.fields.market.country_codes.label')}
</FieldLabel>
<Controller
- name="country_isos"
+ name="country_codes"
control={form.control}
render={({ field }) => (
<CountryMultiCombobox value={field.value} onValueChange={field.onChange} />
)}
/>
<span className="text-xs text-muted-foreground">
- {t('admin.fields.market.country_isos.help')}
+ {t('admin.fields.market.country_codes.help')}
</span>
- <FieldError errors={[errors.country_isos]} />
+ <FieldError errors={[errors.country_codes]} />
</Field>
<TaxProviderField form={form} />
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
index 020f8a9077..ceec398dad 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
@@ -570,8 +570,8 @@ function StockItemRow({ item }: { item: StockItem }) {
function StockLocationFormFields({ form }: { form: UseFormReturn<StockLocationFormValues> }) {
const { t } = useTranslation()
const { errors } = form.formState
- const countryIso = form.watch('country_iso')
- const { states } = useCountryStates(countryIso)
+ const countryCode = form.watch('country_code')
+ const { states } = useCountryStates(countryCode)
const pickupEnabled = form.watch('pickup_enabled')
return (
@@ -707,9 +707,9 @@ function StockLocationFormFields({ form }: { form: UseFormReturn<StockLocationFo
</Field>
</div>
<Field>
- <FieldLabel>{t('admin.fields.country_iso.label')}</FieldLabel>
+ <FieldLabel>{t('admin.fields.country_code.label')}</FieldLabel>
<Controller
- name="country_iso"
+ name="country_code"
control={form.control}
render={({ field }) => (
<CountryCombobox
@@ -722,7 +722,7 @@ function StockLocationFormFields({ form }: { form: UseFormReturn<StockLocationFo
/>
)}
/>
- <FieldError errors={[errors.country_iso]} />
+ <FieldError errors={[errors.country_code]} />
</Field>
{states.length > 0 ? (
<Field>
@@ -732,7 +732,7 @@ function StockLocationFormFields({ form }: { form: UseFormReturn<StockLocationFo
control={form.control}
render={({ field }) => (
<StateCombobox
- countryIso={countryIso}
+ countryCode={countryCode}
states={states}
value={field.value}
onValueChange={field.onChange}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-rates.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-rates.tsx
index bc0f153dc9..b89a8a4d73 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-rates.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-rates.tsx
@@ -231,7 +231,7 @@ function EditTaxRateSheet({
name: taxRate.name,
amount_percentage: taxRate.amount_percentage ?? 0,
tax_category_id: taxRate.tax_category_id ?? '',
- country_iso: taxRate.country_iso ?? '',
+ country_code: taxRate.country_code ?? '',
state_code: taxRate.state_code ?? '',
included_in_price: taxRate.included_in_price,
show_rate_in_label: taxRate.show_rate_in_label,
@@ -294,8 +294,8 @@ function TaxRateFormFields({ form }: { form: UseFormReturn<TaxRateFormValues> })
const { t } = useTranslation()
const { errors } = form.formState
const { data: taxCategories } = useTaxCategories({ limit: 100 })
- const countryIso = form.watch('country_iso')
- const { states } = useCountryStates(countryIso)
+ const countryCode = form.watch('country_code')
+ const { states } = useCountryStates(countryCode)
return (
<FieldGroup>
@@ -366,9 +366,9 @@ function TaxRateFormFields({ form }: { form: UseFormReturn<TaxRateFormValues> })
</Field>
<Field>
- <FieldLabel htmlFor="country_iso">{t('admin.fields.country.label')}</FieldLabel>
+ <FieldLabel htmlFor="country_code">{t('admin.fields.country.label')}</FieldLabel>
<Controller
- name="country_iso"
+ name="country_code"
control={form.control}
render={({ field }) => (
<CountryCombobox
@@ -383,10 +383,10 @@ function TaxRateFormFields({ form }: { form: UseFormReturn<TaxRateFormValues> })
/>
)}
/>
- <FieldDescription>{t('admin.fields.tax_rate.country_iso.help')}</FieldDescription>
+ <FieldDescription>{t('admin.fields.tax_rate.country_code.help')}</FieldDescription>
</Field>
- {countryIso && states.length > 0 && (
+ {countryCode && states.length > 0 && (
<Field>
<FieldLabel htmlFor="state_code">{t('admin.fields.state.label')}</FieldLabel>
<Controller
@@ -394,7 +394,7 @@ function TaxRateFormFields({ form }: { form: UseFormReturn<TaxRateFormValues> })
control={form.control}
render={({ field }) => (
<StateCombobox
- countryIso={countryIso}
+ countryCode={countryCode}
value={field.value}
onValueChange={field.onChange}
states={states}
diff --git a/packages/dashboard/src/schemas/company.ts b/packages/dashboard/src/schemas/company.ts
index b3578811d3..9e7a0ba1d0 100644
--- a/packages/dashboard/src/schemas/company.ts
+++ b/packages/dashboard/src/schemas/company.ts
@@ -33,7 +33,7 @@ const addressSchema = z.object({
city: z.string().optional(),
postal_code: z.string().optional(),
phone: z.string().optional(),
- country_iso: z.string().optional(),
+ country_code: z.string().optional(),
state_code: z.string().optional(),
})
@@ -60,7 +60,7 @@ const EMPTY_ADDRESS = {
city: '',
postal_code: '',
phone: '',
- country_iso: '',
+ country_code: '',
state_code: '',
}
@@ -115,7 +115,7 @@ const ADDRESS_COMPARISON_KEYS = [
'city',
'postal_code',
'phone',
- 'country_iso',
+ 'country_code',
'state_code',
] as const
@@ -142,7 +142,7 @@ export const TAX_IDENTIFIER_KINDS = ['eu_vat', 'gb_vat', 'ch_vat', 'au_abn', 'us
export const taxExemptionCertificateFormSchema = z.object({
certificate_number: z.string().min(1, { error: requiredMessage('certificate_number') }),
reason_code: z.string().min(1, { error: requiredMessage('reason_code') }),
- country_iso: z.string().optional(),
+ country_code: z.string().optional(),
state_code: z.string().optional(),
issued_at: z.string().optional(),
expires_at: z.string().optional(),
@@ -155,7 +155,7 @@ export type TaxExemptionCertificateFormValues = z.infer<typeof taxExemptionCerti
export const TAX_EXEMPTION_CERTIFICATE_DEFAULTS: TaxExemptionCertificateFormValues = {
certificate_number: '',
reason_code: '',
- country_iso: '',
+ country_code: '',
state_code: '',
issued_at: '',
expires_at: '',
@@ -183,7 +183,7 @@ export function taxExemptionCertificateValuesToParams(
return {
certificate_number: values.certificate_number,
reason_code: values.reason_code,
- country_iso: blankToNull(values.country_iso),
+ country_code: blankToNull(values.country_code),
state_code: blankToNull(values.state_code),
issued_at: blankToNull(values.issued_at),
expires_at: blankToNull(values.expires_at),
diff --git a/packages/dashboard/src/schemas/delivery-zone.ts b/packages/dashboard/src/schemas/delivery-zone.ts
index ba84292b4e..4539bf9ccb 100644
--- a/packages/dashboard/src/schemas/delivery-zone.ts
+++ b/packages/dashboard/src/schemas/delivery-zone.ts
@@ -4,7 +4,7 @@ export const MEMBER_TYPES = ['country', 'state', 'postal_code'] as const
export const deliveryZoneMemberSchema = z.object({
member_type: z.enum(MEMBER_TYPES),
- country_iso: z.string().optional(),
+ country_code: z.string().optional(),
state_code: z.string().optional(),
postal_code_prefix: z.string().optional(),
postal_code_from: z.string().optional(),
@@ -43,7 +43,7 @@ export function deliveryZoneValuesToParams(
...(deliveryOriginGroupId ? { delivery_origin_group_id: deliveryOriginGroupId } : {}),
members: values.members.map((member) => ({
member_type: member.member_type,
- ...(member.country_iso ? { country_iso: member.country_iso } : {}),
+ ...(member.country_code ? { country_code: member.country_code } : {}),
...(member.state_code ? { state_code: member.state_code } : {}),
...(member.postal_code_prefix ? { postal_code_prefix: member.postal_code_prefix } : {}),
...(member.postal_code_from ? { postal_code_from: member.postal_code_from } : {}),
diff --git a/packages/dashboard/src/schemas/market.ts b/packages/dashboard/src/schemas/market.ts
index 98429177f0..bdd5ed8d09 100644
--- a/packages/dashboard/src/schemas/market.ts
+++ b/packages/dashboard/src/schemas/market.ts
@@ -9,7 +9,7 @@ export const marketFormSchema = z.object({
supported_locales: z.array(z.string()),
tax_inclusive: z.boolean(),
default: z.boolean(),
- country_isos: z.array(z.string()).min(1, { error: requiredMessage('market.country_isos') }),
+ country_codes: z.array(z.string()).min(1, { error: requiredMessage('market.country_codes') }),
// Empty means the installation default rather than "no tax".
tax_provider: z.string().optional(),
})
@@ -23,7 +23,7 @@ export const MARKET_DEFAULTS: MarketFormValues = {
supported_locales: [],
tax_inclusive: false,
default: false,
- country_isos: [],
+ country_codes: [],
tax_provider: '',
}
@@ -37,7 +37,7 @@ export function marketValuesToParams(v: MarketFormValues): MarketCreateParams &
supported_locales: v.supported_locales.filter((l) => l !== v.default_locale),
tax_inclusive: v.tax_inclusive,
default: v.default,
- country_isos: v.country_isos,
+ country_codes: v.country_codes,
tax_provider: v.tax_provider || null,
}
}
diff --git a/packages/dashboard/src/schemas/stock-location.ts b/packages/dashboard/src/schemas/stock-location.ts
index aabcb30f57..d52b4867a2 100644
--- a/packages/dashboard/src/schemas/stock-location.ts
+++ b/packages/dashboard/src/schemas/stock-location.ts
@@ -31,7 +31,7 @@ export const stockLocationFormSchema = z.object({
zipcode: z.string().optional(),
phone: z.string().optional(),
company: z.string().optional(),
- country_iso: z.string().optional(),
+ country_code: z.string().optional(),
state_code: z.string().optional(),
state_name: z.string().optional(),
pickup_enabled: z.boolean(),
@@ -59,7 +59,7 @@ export const STOCK_LOCATION_DEFAULTS: StockLocationFormValues = {
zipcode: '',
phone: '',
company: '',
- country_iso: '',
+ country_code: '',
state_code: '',
state_name: '',
pickup_enabled: false,
@@ -85,7 +85,7 @@ export function stockLocationToFormValues(sl: StockLocation): StockLocationFormV
zipcode: sl.zipcode ?? '',
phone: sl.phone ?? '',
company: sl.company ?? '',
- country_iso: sl.country_iso ?? '',
+ country_code: sl.country_code ?? '',
state_code: sl.state_code ?? '',
state_name: sl.state_name ?? '',
pickup_enabled: sl.pickup_enabled,
@@ -115,7 +115,7 @@ export function formValuesToParams(
zipcode: blankToUndefined(v.zipcode),
phone: blankToUndefined(v.phone),
company: blankToUndefined(v.company),
- country_iso: blankToUndefined(v.country_iso),
+ country_code: blankToUndefined(v.country_code),
state_code: blankToUndefined(v.state_code),
state_name: blankToUndefined(v.state_name),
pickup_enabled: v.pickup_enabled,
diff --git a/packages/dashboard/src/schemas/tax-rate.ts b/packages/dashboard/src/schemas/tax-rate.ts
index 62a017cd69..d8a3466da4 100644
--- a/packages/dashboard/src/schemas/tax-rate.ts
+++ b/packages/dashboard/src/schemas/tax-rate.ts
@@ -10,7 +10,7 @@ export const taxRateFormSchema = z.object({
// Required: a rate always taxes exactly one category.
tax_category_id: z.string().min(1, { error: requiredMessage('tax_rate.tax_category_id') }),
// Empty means the rate applies everywhere, so neither field is required.
- country_iso: z.string().optional(),
+ country_code: z.string().optional(),
state_code: z.string().optional(),
included_in_price: z.boolean(),
show_rate_in_label: z.boolean(),
@@ -22,7 +22,7 @@ export const TAX_RATE_DEFAULTS: TaxRateFormValues = {
name: '',
amount_percentage: 0,
tax_category_id: '',
- country_iso: '',
+ country_code: '',
state_code: '',
included_in_price: false,
show_rate_in_label: false,
@@ -38,7 +38,7 @@ export function taxRateValuesToParams(values: TaxRateFormValues): TaxRateParams
name: values.name,
amount: values.amount_percentage / 100,
tax_category_id: values.tax_category_id,
- country_iso: blankToNull(values.country_iso),
+ country_code: blankToNull(values.country_code),
state_code: blankToNull(values.state_code),
included_in_price: values.included_in_price,
show_rate_in_label: values.show_rate_in_label,
diff --git a/packages/dashboard/src/tables/markets.tsx b/packages/dashboard/src/tables/markets.tsx
index 11188ee04e..bd90b23305 100644
--- a/packages/dashboard/src/tables/markets.tsx
+++ b/packages/dashboard/src/tables/markets.tsx
@@ -23,7 +23,7 @@ defineTable<Market>('markets', {
id={market.id}
dataAttr="data-market-id"
name={market.name}
- secondary={market.country_isos.length > 0 ? market.country_isos.join(', ') : undefined}
+ secondary={market.country_codes.length > 0 ? market.country_codes.join(', ') : undefined}
/>
),
},
diff --git a/packages/dashboard/src/tables/stock-locations.tsx b/packages/dashboard/src/tables/stock-locations.tsx
index 4a263eea96..a8441e1f64 100644
--- a/packages/dashboard/src/tables/stock-locations.tsx
+++ b/packages/dashboard/src/tables/stock-locations.tsx
@@ -53,7 +53,7 @@ defineTable<StockLocation>('stock-locations', {
label: i18n.t('admin.stock_locations.columns.location'),
default: true,
render: (sl) => {
- const parts = [sl.city, sl.state_text || sl.state_code, sl.country_iso]
+ const parts = [sl.city, sl.state_text || sl.state_code, sl.country_code]
.filter(Boolean)
.join(', ')
return parts || '—'
diff --git a/packages/dashboard/src/tables/tax-rates.tsx b/packages/dashboard/src/tables/tax-rates.tsx
index cf63b5b4cc..dccb92c510 100644
--- a/packages/dashboard/src/tables/tax-rates.tsx
+++ b/packages/dashboard/src/tables/tax-rates.tsx
@@ -33,13 +33,13 @@ defineTable<TaxRate>('tax-rates', {
taxRate.amount_percentage === null ? '—' : `${taxRate.amount_percentage}%`,
},
{
- key: 'country_iso',
+ key: 'country_code',
label: i18n.t('admin.fields.tax_rate.jurisdiction.label'),
sortable: true,
filterable: true,
default: true,
render: (taxRate) => (
- <JurisdictionLabel countryIso={taxRate.country_iso} stateCode={taxRate.state_code} />
+ <JurisdictionLabel countryCode={taxRate.country_code} stateCode={taxRate.state_code} />
),
},
{
diff --git a/packages/sdk-core/src/types.ts b/packages/sdk-core/src/types.ts
index bd866873ec..8a7ab8b7bb 100644
--- a/packages/sdk-core/src/types.ts
+++ b/packages/sdk-core/src/types.ts
@@ -59,7 +59,7 @@ export interface AddressParams {
phone?: string
company?: string
/** ISO 3166-1 alpha-2 country code (e.g., "US", "DE") */
- country_iso: string
+ country_code: string
/** ISO 3166-2 subdivision code without country prefix (e.g., "CA", "NY") */
state_abbr?: string
/** State name - used for countries without predefined states */
diff --git a/packages/sdk/examples/carts/update.ts b/packages/sdk/examples/carts/update.ts
index 3d1c9eef48..f74a0a2338 100644
--- a/packages/sdk/examples/carts/update.ts
+++ b/packages/sdk/examples/carts/update.ts
@@ -6,20 +6,25 @@ const client = createClient({
})
// region:example
-const cart = await client.carts.update('cart_abc123', {
- email: '[email protected]',
- shipping_address: {
- first_name: 'John',
- last_name: 'Doe',
- address1: '123 Main St',
- city: 'New York',
- postal_code: '10001',
- country_iso: 'US',
- state_abbr: 'NY',
+const cart = await client.carts.update(
+ 'cart_abc123',
+ {
+ email: '[email protected]',
+ shipping_address: {
+ first_name: 'John',
+ last_name: 'Doe',
+ address1: '123 Main St',
+ city: 'New York',
+ postal_code: '10001',
+ country_code: 'US',
+ state_abbr: 'NY',
+ },
},
-}, {
- token: '<token>',
-})
+ {
+ token: '<token>',
+ },
+)
+
// endregion:example
export { cart }
diff --git a/packages/sdk/examples/customer-addresses/create.ts b/packages/sdk/examples/customer-addresses/create.ts
index 332fb3dafa..14a4b0fea6 100644
--- a/packages/sdk/examples/customer-addresses/create.ts
+++ b/packages/sdk/examples/customer-addresses/create.ts
@@ -6,18 +6,22 @@ const client = createClient({
})
// region:example
-const address = await client.customer.addresses.create({
- first_name: 'John',
- last_name: 'Doe',
- address1: '123 Main St',
- city: 'New York',
- postal_code: '10001',
- country_iso: 'US',
- state_abbr: 'NY',
- phone: '+1 555 123 4567',
-}, {
- token: '<token>',
-})
+const address = await client.customer.addresses.create(
+ {
+ first_name: 'John',
+ last_name: 'Doe',
+ address1: '123 Main St',
+ city: 'New York',
+ postal_code: '10001',
+ country_code: 'US',
+ state_abbr: 'NY',
+ phone: '+1 555 123 4567',
+ },
+ {
+ token: '<token>',
+ },
+)
+
// endregion:example
export { address }
diff --git a/packages/sdk/src/types/generated/Address.ts b/packages/sdk/src/types/generated/Address.ts
index 573dc947ef..6a43b976f1 100644
--- a/packages/sdk/src/types/generated/Address.ts
+++ b/packages/sdk/src/types/generated/Address.ts
@@ -1,4 +1,4 @@
-// Typelizer digest bd92bb53349211e98060b99a81e1370c
+// Typelizer digest ae6dcb29f0fe083fb2edf1bbc854d643
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
@@ -14,13 +14,14 @@ interface Address {
phone: string | null;
company: string | null;
country_name: string;
- country_iso: string;
+ country_code: string;
state_text: string | null;
state_code: string | null;
quick_checkout: boolean;
is_default_billing: boolean;
is_default_shipping: boolean;
state_abbr: string | null;
+ country_iso: string;
state_name: string | null;
}
diff --git a/packages/sdk/src/types/generated/DeliveryZoneMember.ts b/packages/sdk/src/types/generated/DeliveryZoneMember.ts
index 8aefc9af30..5f701e9376 100644
--- a/packages/sdk/src/types/generated/DeliveryZoneMember.ts
+++ b/packages/sdk/src/types/generated/DeliveryZoneMember.ts
@@ -1,11 +1,11 @@
-// Typelizer digest 9dd164ab2244cddd5bdcc97a0b659cf8
+// Typelizer digest 8da35505ba2d32c9927272f52cd0125b
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
interface DeliveryZoneMember {
id: string;
member_type: string;
- country_iso: string | null;
+ country_code: string | null;
state_code: string | null;
postal_code_prefix: string | null;
postal_code_from: string | null;
diff --git a/packages/sdk/src/types/generated/Market.ts b/packages/sdk/src/types/generated/Market.ts
index e6d24bc139..230ea1f1d3 100644
--- a/packages/sdk/src/types/generated/Market.ts
+++ b/packages/sdk/src/types/generated/Market.ts
@@ -1,4 +1,4 @@
-// Typelizer digest f0c3fec6413da2882bdac9d862de6523
+// Typelizer digest ae2dab21fb8c33f769d36001241124d3
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Country} from '@/types'
@@ -10,7 +10,7 @@ interface Market {
default_locale: string;
tax_inclusive: boolean;
default: boolean;
- country_isos: Array<string>;
+ country_codes: Array<string>;
supported_locales: Array<string>;
countries?: Array<Country>;
}
diff --git a/packages/sdk/src/types/generated/StockLocation.ts b/packages/sdk/src/types/generated/StockLocation.ts
index 3742a47a6c..b259c99595 100644
--- a/packages/sdk/src/types/generated/StockLocation.ts
+++ b/packages/sdk/src/types/generated/StockLocation.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 59937aeee4b0339f09f646d38f210dca
+// Typelizer digest 3b49ffc67852ba0c1859e13fee9e7c23
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
@@ -8,7 +8,7 @@ interface StockLocation {
address1: string | null;
city: string | null;
zipcode: string | null;
- country_iso: string | null;
+ country_code: string | null;
country_name: string | null;
state_code: string | null;
state_text: string | null;
diff --git a/packages/sdk/src/zod/generated/Address.ts b/packages/sdk/src/zod/generated/Address.ts
index dcdf3e2720..ad8da09297 100644
--- a/packages/sdk/src/zod/generated/Address.ts
+++ b/packages/sdk/src/zod/generated/Address.ts
@@ -13,13 +13,14 @@ export const AddressSchema = z.object({
phone: z.string().nullable(),
company: z.string().nullable(),
country_name: z.string(),
- country_iso: z.string(),
+ country_code: z.string(),
state_text: z.string().nullable(),
state_code: z.string().nullable(),
quick_checkout: z.boolean(),
is_default_billing: z.boolean(),
is_default_shipping: z.boolean(),
state_abbr: z.string().nullable(),
+ country_iso: z.string(),
state_name: z.string().nullable(),
});
diff --git a/packages/sdk/src/zod/generated/DeliveryZoneMember.ts b/packages/sdk/src/zod/generated/DeliveryZoneMember.ts
index c1061efb4e..f7d9bcf62d 100644
--- a/packages/sdk/src/zod/generated/DeliveryZoneMember.ts
+++ b/packages/sdk/src/zod/generated/DeliveryZoneMember.ts
@@ -4,7 +4,7 @@ import { z } from 'zod';
export const DeliveryZoneMemberSchema = z.object({
id: z.string(),
member_type: z.string(),
- country_iso: z.string().nullable(),
+ country_code: z.string().nullable(),
state_code: z.string().nullable(),
postal_code_prefix: z.string().nullable(),
postal_code_from: z.string().nullable(),
diff --git a/packages/sdk/src/zod/generated/Market.ts b/packages/sdk/src/zod/generated/Market.ts
index 6f1354430e..587d0488ad 100644
--- a/packages/sdk/src/zod/generated/Market.ts
+++ b/packages/sdk/src/zod/generated/Market.ts
@@ -9,7 +9,7 @@ export const MarketSchema: z.ZodObject<any> = z.object({
default_locale: z.string(),
tax_inclusive: z.boolean(),
default: z.boolean(),
- country_isos: z.array(z.string()),
+ country_codes: z.array(z.string()),
supported_locales: z.array(z.string()),
countries: z.array(z.lazy(() => CountrySchema)).optional(),
});
diff --git a/packages/sdk/src/zod/generated/StockLocation.ts b/packages/sdk/src/zod/generated/StockLocation.ts
index 2f82b8e196..219f44d218 100644
--- a/packages/sdk/src/zod/generated/StockLocation.ts
+++ b/packages/sdk/src/zod/generated/StockLocation.ts
@@ -7,7 +7,7 @@ export const StockLocationSchema = z.object({
address1: z.string().nullable(),
city: z.string().nullable(),
zipcode: z.string().nullable(),
- country_iso: z.string().nullable(),
+ country_code: z.string().nullable(),
country_name: z.string().nullable(),
state_code: z.string().nullable(),
state_text: z.string().nullable(),
diff --git a/packages/sdk/tests/customer.test.ts b/packages/sdk/tests/customer.test.ts
index 1f473a5052..391af05f86 100644
--- a/packages/sdk/tests/customer.test.ts
+++ b/packages/sdk/tests/customer.test.ts
@@ -72,7 +72,7 @@ describe('customer', () => {
address1: '123 Main St',
city: 'New York',
postal_code: '10001',
- country_iso: 'US',
+ country_code: 'US',
},
opts,
)
diff --git a/packages/sdk/tests/error-handling.test.ts b/packages/sdk/tests/error-handling.test.ts
index 2dcc14b5ff..ffe18ef7fa 100644
--- a/packages/sdk/tests/error-handling.test.ts
+++ b/packages/sdk/tests/error-handling.test.ts
@@ -64,7 +64,7 @@ describe('error handling', () => {
address1: '',
city: '',
postal_code: '00000',
- country_iso: 'US',
+ country_code: 'US',
},
{ token: 'jwt' },
)
diff --git a/packages/sdk/tests/integration/customer.test.ts b/packages/sdk/tests/integration/customer.test.ts
index 3b9aa6107d..d00830b094 100644
--- a/packages/sdk/tests/integration/customer.test.ts
+++ b/packages/sdk/tests/integration/customer.test.ts
@@ -21,7 +21,7 @@ describe('customer addresses', () => {
address1: '50 Wall St',
city: 'New York',
postal_code: '10005',
- country_iso: 'US',
+ country_code: 'US',
state_abbr: 'NY',
},
authOpts(),
@@ -46,7 +46,7 @@ describe('customer addresses', () => {
address1: '100 Broadway',
city: 'New York',
postal_code: '10005',
- country_iso: 'US',
+ country_code: 'US',
state_abbr: 'NY',
is_default_billing: true,
},
@@ -66,7 +66,7 @@ describe('customer addresses', () => {
address1: '200 Park Ave',
city: 'New York',
postal_code: '10166',
- country_iso: 'US',
+ country_code: 'US',
state_abbr: 'NY',
},
authOpts(),
@@ -105,7 +105,7 @@ describe('customer orders', () => {
address1: '1 Times Square',
city: 'New York',
postal_code: '10036',
- country_iso: creds.country_iso,
+ country_code: creds.country_code,
state_abbr: 'NY',
phone: '555-0100',
}
diff --git a/packages/sdk/tests/integration/global-setup.ts b/packages/sdk/tests/integration/global-setup.ts
index 24bb0aedf7..77242800b5 100644
--- a/packages/sdk/tests/integration/global-setup.ts
+++ b/packages/sdk/tests/integration/global-setup.ts
@@ -42,7 +42,7 @@ const CREDENTIALS_RUBY = [
'p = s.products.available.first',
'c = s.categories.first',
'port = ENV.fetch("PORT", 3010)',
- 'puts JSON.generate(base_url: "http://localhost:#{port}", publishable_key: k.token, jwt_token: jwt, user_email: u.email, user_password: "spree123", product_slug: p&.slug, product_id: p&.prefixed_id, variant_id: p&.default_variant&.prefixed_id, category_id: c&.prefixed_id, category_permalink: c&.permalink, country_iso: "US", store_name: s.name, bogus_payment_method_id: pm.prefixed_id, check_payment_method_id: check.prefixed_id)',
+ 'puts JSON.generate(base_url: "http://localhost:#{port}", publishable_key: k.token, jwt_token: jwt, user_email: u.email, user_password: "spree123", product_slug: p&.slug, product_id: p&.prefixed_id, variant_id: p&.default_variant&.prefixed_id, category_id: c&.prefixed_id, category_permalink: c&.permalink, country_code: "US", store_name: s.name, bogus_payment_method_id: pm.prefixed_id, check_payment_method_id: check.prefixed_id)',
].join('; ')
let serverProcess: ChildProcess | null = null
diff --git a/packages/sdk/tests/integration/helpers.ts b/packages/sdk/tests/integration/helpers.ts
index 35685832b6..c5beddba01 100644
--- a/packages/sdk/tests/integration/helpers.ts
+++ b/packages/sdk/tests/integration/helpers.ts
@@ -20,7 +20,7 @@ export function testAddress(overrides: Record<string, string> = {}) {
address1: '1 Times Square',
city: 'New York',
postal_code: '10036',
- country_iso: getCredentials().country_iso,
+ country_code: getCredentials().country_code,
state_abbr: 'NY',
phone: '555-0100',
...overrides,
diff --git a/packages/sdk/tests/integration/setup.ts b/packages/sdk/tests/integration/setup.ts
index 86c07cc1f7..f4e941225e 100644
--- a/packages/sdk/tests/integration/setup.ts
+++ b/packages/sdk/tests/integration/setup.ts
@@ -15,7 +15,7 @@ export interface TestCredentials {
variant_id: string
category_id: string
category_permalink: string
- country_iso: string
+ country_code: string
store_name: string
bogus_payment_method_id: string
check_payment_method_id: string
diff --git a/packages/sdk/tests/mocks/handlers.ts b/packages/sdk/tests/mocks/handlers.ts
index 753f482ed8..36c5a8d755 100644
--- a/packages/sdk/tests/mocks/handlers.ts
+++ b/packages/sdk/tests/mocks/handlers.ts
@@ -78,7 +78,7 @@ export const fixtures = {
address1: '123 Main St',
city: 'New York',
postal_code: '10001',
- country_iso: 'US',
+ country_code: 'US',
state_abbr: 'NY',
},
category: {
diff --git a/spree/api/app/controllers/concerns/spree/api/v3/locale_and_currency.rb b/spree/api/app/controllers/concerns/spree/api/v3/locale_and_currency.rb
index 5979e0739a..24341e2fc7 100644
--- a/spree/api/app/controllers/concerns/spree/api/v3/locale_and_currency.rb
+++ b/spree/api/app/controllers/concerns/spree/api/v3/locale_and_currency.rb
@@ -171,10 +171,10 @@ module Spree
# When a matching market is found, it is set on +Spree::Current.market+,
# which influences the default locale and currency fallbacks.
def set_market_from_country
- country_iso = request.headers['x-spree-country'].presence || params[:country].presence
- return unless country_iso
+ country_code = request.headers['x-spree-country'].presence || params[:country].presence
+ return unless country_code
- country = Spree::Country.by_iso(country_iso)
+ country = Spree::Country.by_iso(country_code)
return unless country
market = current_store&.market_for_country(country)
diff --git a/spree/api/app/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller.rb
index b53e42ea19..9ab7d154c4 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller.rb
@@ -100,7 +100,7 @@ module Spree
# POST /api/v3/admin/direct_uploads.
def permitted_params
params.permit(:certificate_number, :reason_code, :issuing_authority,
- :issued_at, :expires_at, :country_iso, :state_code, :document,
+ :issued_at, :expires_at, :country_code, :state_code, :document,
metadata: {})
end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/concerns/company_location_params.rb b/spree/api/app/controllers/spree/api/v3/admin/concerns/company_location_params.rb
index 3507c09d04..66ce4057ce 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/concerns/company_location_params.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/concerns/company_location_params.rb
@@ -12,7 +12,7 @@ module Spree
# permits :id, :user_id and :deleted_at.
ADDRESS_KEYS = [
:first_name, :last_name, :company, :address1, :address2, :city,
- :postal_code, :zipcode, :phone, :country_iso, :state_code, :state_name, :label
+ :postal_code, :zipcode, :phone, :country_code, :state_code, :state_name, :label
].freeze
protected
diff --git a/spree/api/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb
index 399f7ecb02..78cc34442a 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb
@@ -68,7 +68,7 @@ module Spree
params.permit(
:firstname, :lastname, :first_name, :last_name,
:address1, :address2, :city,
- :country_iso, :state_code,
+ :country_code, :state_code,
:zipcode, :postal_code, :phone, :alternative_phone,
:state_name, :company, :label, :quick_checkout
)
diff --git a/spree/api/app/controllers/spree/api/v3/admin/delivery_zones_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/delivery_zones_controller.rb
index e647fdb033..3cb9f7aa1c 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/delivery_zones_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/delivery_zones_controller.rb
@@ -52,7 +52,7 @@ module Spree
def permitted_params
params.permit(
:name, :description, :delivery_profile_id, :delivery_origin_group_id,
- members: [:member_type, :country_iso, :state_code, :postal_code_prefix, :postal_code_from, :postal_code_to]
+ members: [:member_type, :country_code, :state_code, :postal_code_prefix, :postal_code_from, :postal_code_to]
)
end
@@ -83,15 +83,15 @@ module Spree
def build_members(zone)
Array(permitted_params[:members]).each do |member|
attributes = member.to_h.symbolize_keys
- country_iso = attributes[:country_iso].presence&.to_s&.upcase
+ country_code = attributes[:country_code].presence&.to_s&.upcase
state_value = attributes[:state_code].presence
if state_value.present?
- country_iso ||= infer_country_iso_for_state(state_value)
- attributes[:state_code] = Spree::IsoData.subdivision_code(country_iso, state_value) if country_iso
+ country_code ||= infer_country_code_for_state(state_value)
+ attributes[:state_code] = Spree::IsoData.subdivision_code(country_code, state_value) if country_code
end
- attributes[:country_iso] = country_iso
+ attributes[:country_code] = country_code
zone.members.build(attributes)
end
end
@@ -101,7 +101,7 @@ module Spree
# than silently picking one of several matching countries.
#
# @return [String, nil] the only country whose subdivisions match, if exactly one does
- def infer_country_iso_for_state(state_value)
+ def infer_country_code_for_state(state_value)
matches = Spree::IsoData.countries.map(&:alpha2).select do |iso|
Spree::IsoData.subdivision_code(iso, state_value).present?
end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/markets_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/markets_controller.rb
index 838d517167..0abea80fe4 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/markets_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/markets_controller.rb
@@ -7,8 +7,8 @@ module Spree
# `scope` chain narrows appropriately when we restrict to
# `current_store.markets`.
#
- # `country_isos` and `supported_locales` are accepted as arrays on the
- # wire and translated by model setters (`Spree::Market#country_isos=`,
+ # `country_codes` and `supported_locales` are accepted as arrays on the
+ # wire and translated by model setters (`Spree::Market#country_codes=`,
# `#supported_locales=`).
class MarketsController < ResourceController
scoped_resource :settings
@@ -31,7 +31,7 @@ module Spree
normalize_params(
params.permit(
:name, :currency, :default_locale, :tax_inclusive, :tax_provider,
- :default, :position, supported_locales: [], country_isos: []
+ :default, :position, supported_locales: [], country_codes: []
)
)
end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb
index 4691cb226b..4bd81d60a3 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb
@@ -190,7 +190,7 @@ module Spree
[
:firstname, :lastname, :first_name, :last_name,
:address1, :address2, :city,
- :country_iso, :state_code,
+ :country_code, :state_code,
:zipcode, :postal_code, :phone, :alternative_phone,
:state_name, :company, :label
]
diff --git a/spree/api/app/controllers/spree/api/v3/admin/setup_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/setup_controller.rb
index e1f3f7177d..4a315ea25d 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/setup_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/setup_controller.rb
@@ -29,10 +29,10 @@ module Spree
# POST /api/v3/admin/auth/setup
# Body: { setup_token, email, password, password_confirmation?,
- # first_name?, last_name?, store_name, currency?, country_iso? }
+ # first_name?, last_name?, store_name, currency?, country_code? }
def create
return render_setup_unavailable unless setup_token_usable?
- return render_unknown_country if unknown_country_iso?
+ return render_unknown_country if unknown_country_code?
user = nil
store = Spree::Store.default
@@ -76,14 +76,14 @@ module Spree
# Checked before the token is spent: setup is one-shot, so applying a
# store with the wrong country — or silently ignoring the request —
# would leave no in-band way to correct it.
- def unknown_country_iso?
- params[:country_iso].present? && Spree::Country.by_iso(params[:country_iso]).nil?
+ def unknown_country_code?
+ params[:country_code].present? && Spree::Country.by_iso(params[:country_code]).nil?
end
def render_unknown_country
render_error(
code: ERROR_CODES[:resource_invalid],
- message: "Unknown country #{params[:country_iso]}",
+ message: "Unknown country #{params[:country_code]}",
status: :unprocessable_content
)
end
@@ -113,7 +113,7 @@ module Spree
# `store_name` is optional: an API client may claim the installation
# without renaming the seeded store (the dashboard's form requires
# it, but the endpoint is the documented surface). `currency` and
- # `country_iso` are applied only when they resolve to something real
+ # `country_code` are applied only when they resolve to something real
# — the token is spent in the same request, so persisting a typo
# here would be unrecoverable in-band.
def store_params
@@ -126,9 +126,9 @@ module Spree
permitted[:default_currency] = currency.iso_code if currency
end
- if params[:country_iso].present?
- country = Spree::Country.by_iso(params[:country_iso])
- permitted[:default_country_iso_code] = country.iso if country
+ if params[:country_code].present?
+ country = Spree::Country.by_iso(params[:country_code])
+ permitted[:default_country_code] = country.iso if country
end
permitted
diff --git a/spree/api/app/controllers/spree/api/v3/admin/stock_locations_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/stock_locations_controller.rb
index 169100ecc0..7d3a28d57d 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/stock_locations_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/stock_locations_controller.rb
@@ -30,7 +30,7 @@ module Spree
:name, :admin_name, :active, :default,
:kind, :propagate_all_variants, :backorderable_default,
:address1, :address2, :city, :zipcode, :phone, :company,
- :country_iso, :state_code, :state_name,
+ :country_code, :state_code, :state_name,
:pickup_enabled, :pickup_stock_policy,
:pickup_ready_in_minutes, :pickup_instructions
)
diff --git a/spree/api/app/controllers/spree/api/v3/admin/tax_rates_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/tax_rates_controller.rb
index ff172990cc..0aa0e9c50d 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/tax_rates_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/tax_rates_controller.rb
@@ -24,7 +24,7 @@ module Spree
def permitted_params
params.permit(:name, :amount, :amount_percentage, :included_in_price,
:show_rate_in_label, :tax_category_id,
- :country_iso, :state_code, metadata: {})
+ :country_code, :state_code, metadata: {})
end
end
end
diff --git a/spree/api/app/controllers/spree/api/v3/store/carts_controller.rb b/spree/api/app/controllers/spree/api/v3/store/carts_controller.rb
index 21162e43a3..3ec299df94 100644
--- a/spree/api/app/controllers/spree/api/v3/store/carts_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/store/carts_controller.rb
@@ -181,8 +181,8 @@ module Spree
:id, :first_name, :last_name,
:address1, :address2,
:city, :postal_code, :phone, :company,
- # state_abbr is the legacy write name, accepted until 6.1.
- :country_iso, :state_code, :state_abbr, :state_name, :quick_checkout
+ # country_iso and state_abbr are the legacy write names, accepted until 6.1.
+ :country_code, :country_iso, :state_code, :state_abbr, :state_name, :quick_checkout
]
end
diff --git a/spree/api/app/controllers/spree/api/v3/store/customer/addresses_controller.rb b/spree/api/app/controllers/spree/api/v3/store/customer/addresses_controller.rb
index 1559382543..c4e8537aae 100644
--- a/spree/api/app/controllers/spree/api/v3/store/customer/addresses_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/store/customer/addresses_controller.rb
@@ -64,8 +64,8 @@ module Spree
def permitted_params
params.permit(
:first_name, :last_name, :address1, :address2, :city,
- # state_abbr is the legacy write name, accepted until 6.1.
- :postal_code, :phone, :company, :country_iso, :state_code, :state_abbr, :state_name,
+ # country_iso and state_abbr are the legacy write names, accepted until 6.1.
+ :postal_code, :phone, :company, :country_code, :country_iso, :state_code, :state_abbr, :state_name,
:is_default_billing, :is_default_shipping
)
end
diff --git a/spree/api/app/controllers/spree/api/v3/store/markets_controller.rb b/spree/api/app/controllers/spree/api/v3/store/markets_controller.rb
index 7e949f0e9c..620d32fc43 100644
--- a/spree/api/app/controllers/spree/api/v3/store/markets_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/store/markets_controller.rb
@@ -28,8 +28,8 @@ module Spree
# GET /api/v3/store/markets/resolve?country=DE
def resolve
- country_iso = params[:country]&.upcase
- country = Spree::Country.find_by_iso!(country_iso)
+ country_code = params[:country]&.upcase
+ country = Spree::Country.find_by_iso!(country_code)
market = current_store.market_for_country(country)
raise ActiveRecord::RecordNotFound unless market
diff --git a/spree/api/app/serializers/spree/api/v3/address_serializer.rb b/spree/api/app/serializers/spree/api/v3/address_serializer.rb
index fd38d07be4..eaa100e9a1 100644
--- a/spree/api/app/serializers/spree/api/v3/address_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/address_serializer.rb
@@ -7,16 +7,18 @@ module Spree
city: [:string, nullable: true], postal_code: [:string, nullable: true], phone: [:string, nullable: true],
company: [:string, nullable: true], state_code: [:string, nullable: true],
state_abbr: [:string, nullable: true], state_name: [:string, nullable: true],
- state_text: [:string, nullable: true], country_iso: :string, country_name: :string,
+ state_text: [:string, nullable: true], country_code: :string, country_iso: :string,
+ country_name: :string,
quick_checkout: :boolean, is_default_billing: :boolean, is_default_shipping: :boolean
attributes :first_name, :last_name, :full_name, :address1, :address2, :postal_code,
- :city, :phone, :company, :country_name, :country_iso, :state_text,
+ :city, :phone, :company, :country_name, :country_code, :state_text,
:state_code, :quick_checkout, :is_default_billing, :is_default_shipping
- # @deprecated Storefronts shipped against this name; use +state_code+.
- # Removed in 6.1.
+ # @deprecated Storefronts shipped against these names; use +state_code+
+ # and +country_code+. Removed in 6.1.
attribute :state_abbr, &:state_code
+ attribute :country_iso, &:country_code
# State name - used for countries without predefined states
attribute :state_name do |address|
diff --git a/spree/api/app/serializers/spree/api/v3/admin/tax_exemption_certificate_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/tax_exemption_certificate_serializer.rb
index e72373d808..66f24edc2b 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/tax_exemption_certificate_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/tax_exemption_certificate_serializer.rb
@@ -8,7 +8,7 @@ module Spree
typelize certificate_number: :string, reason_code: :string, status: :string,
issuing_authority: [:string, nullable: true],
company_id: :string,
- country_iso: [:string, nullable: true], state_code: [:string, nullable: true],
+ country_code: [:string, nullable: true], state_code: [:string, nullable: true],
active: :boolean, lapsed: :boolean, can_be_deleted: :boolean,
document_filename: [:string, nullable: true],
document_byte_size: ['number | null'],
@@ -25,7 +25,7 @@ module Spree
# The jurisdiction the certificate holds in, in the same vocabulary the
# tax lines use.
- attributes :country_iso, :state_code
+ attributes :country_code, :state_code
# Whether it counts right now — the status alone can't say, since a
# verified certificate stops counting once its date passes.
diff --git a/spree/api/app/serializers/spree/api/v3/admin/tax_line_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/tax_line_serializer.rb
index 92e329fafa..a8e970694b 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/tax_line_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/tax_line_serializer.rb
@@ -5,14 +5,14 @@ module Spree
class TaxLineSerializer < V3::TaxLineSerializer
typelize amount: [:string, nullable: false], display_amount: [:string, nullable: false],
provider_id: [:string, nullable: true], metadata: ['Record<string, unknown>', nullable: true],
- taxability_reason: [:string, nullable: true], country_iso: [:string, nullable: true],
+ taxability_reason: [:string, nullable: true], country_code: [:string, nullable: true],
state_code: [:string, nullable: true], data: ['Record<string, unknown>', nullable: true]
# The treatment and its jurisdiction stay admin-only: no surveyed
# platform shows a buyer a machine-readable tax reason, and `label`
# already covers what they need. `data` carries the provider's own
# breakdown, which is what an e-invoicing integration reads.
- attributes :provider_id, :metadata, :taxability_reason, :country_iso, :state_code, :data,
+ attributes :provider_id, :metadata, :taxability_reason, :country_code, :state_code, :data,
created_at: :iso8601, updated_at: :iso8601
end
end
diff --git a/spree/api/app/serializers/spree/api/v3/admin/tax_rate_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/tax_rate_serializer.rb
index f9d3e0b455..e86a6f8f59 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/tax_rate_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/tax_rate_serializer.rb
@@ -12,7 +12,7 @@ module Spree
show_rate_in_label: :boolean,
tax_category_id: [:string, nullable: true],
store_id: [:string, nullable: true],
- country_iso: [:string, nullable: true],
+ country_code: [:string, nullable: true],
state_code: [:string, nullable: true],
metadata: ['Record<string, unknown>', nullable: true],
deleted_at: [:string, nullable: true]
@@ -41,7 +41,7 @@ module Spree
# The jurisdiction the rate taxes, as codes: a null country means every
# country, and a country with no state means the whole country. Read
# and written under the same two names.
- attributes :country_iso, :state_code
+ attributes :country_code, :state_code
end
end
end
diff --git a/spree/api/app/serializers/spree/api/v3/delivery_zone_member_serializer.rb b/spree/api/app/serializers/spree/api/v3/delivery_zone_member_serializer.rb
index 9a35fb1eb9..053963c008 100644
--- a/spree/api/app/serializers/spree/api/v3/delivery_zone_member_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/delivery_zone_member_serializer.rb
@@ -2,14 +2,14 @@ module Spree
module Api
module V3
class DeliveryZoneMemberSerializer < BaseSerializer
- typelize member_type: :string, country_iso: [:string, nullable: true],
+ typelize member_type: :string, country_code: [:string, nullable: true],
country_name: [:string, nullable: true],
state_code: [:string, nullable: true], state_name: [:string, nullable: true],
postal_code_prefix: [:string, nullable: true],
postal_code_from: [:string, nullable: true],
postal_code_to: [:string, nullable: true]
- attributes :member_type, :country_iso, :state_code,
+ attributes :member_type, :country_code, :state_code,
:postal_code_prefix, :postal_code_from, :postal_code_to
# Admin zone summaries list countries by name; without this every
@@ -21,7 +21,7 @@ module Spree
# The subdivision's name is reference data rather than something the
# member stores, so it is looked up from its country and code.
attribute :state_name do |record|
- Spree::IsoData.subdivision_name(record.country_iso, record.state_code) if record.state_code.present?
+ Spree::IsoData.subdivision_name(record.country_code, record.state_code) if record.state_code.present?
end
end
end
diff --git a/spree/api/app/serializers/spree/api/v3/market_serializer.rb b/spree/api/app/serializers/spree/api/v3/market_serializer.rb
index a151fbcdff..cbea5ef423 100644
--- a/spree/api/app/serializers/spree/api/v3/market_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/market_serializer.rb
@@ -5,11 +5,11 @@ module Spree
typelize name: :string, currency: :string,
default_locale: :string,
supported_locales: [:string, multi: true],
- country_isos: [:string, multi: true],
+ country_codes: [:string, multi: true],
tax_inclusive: :boolean,
default: :boolean
- attributes :name, :currency, :default_locale, :tax_inclusive, :default, :country_isos
+ attributes :name, :currency, :default_locale, :tax_inclusive, :default, :country_codes
attribute :supported_locales do |market|
market.supported_locales_list
diff --git a/spree/api/app/serializers/spree/api/v3/stock_location_serializer.rb b/spree/api/app/serializers/spree/api/v3/stock_location_serializer.rb
index 0828866a5c..743599160d 100644
--- a/spree/api/app/serializers/spree/api/v3/stock_location_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/stock_location_serializer.rb
@@ -3,13 +3,13 @@ module Spree
module V3
class StockLocationSerializer < BaseSerializer
typelize name: :string, address1: [:string, nullable: true], city: [:string, nullable: true],
- zipcode: [:string, nullable: true], country_iso: [:string, nullable: true],
+ zipcode: [:string, nullable: true], country_code: [:string, nullable: true],
country_name: [:string, nullable: true], state_code: [:string, nullable: true],
state_text: [:string, nullable: true],
pickup_ready_in_minutes: [:number, nullable: true],
pickup_instructions: [:string, nullable: true]
- attributes :name, :address1, :city, :zipcode, :country_iso, :country_name, :state_code, :state_text
+ attributes :name, :address1, :city, :zipcode, :country_code, :country_name, :state_code, :state_text
# Collection details the customer needs when choosing a counter: how
# long until the order is ready, and where to go. This serializer
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/companies/locations_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/companies/locations_controller_spec.rb
index 688059ed4e..c15ae46143 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/companies/locations_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/companies/locations_controller_spec.rb
@@ -47,7 +47,7 @@ RSpec.describe Spree::Api::V3::Admin::Companies::LocationsController, type: :con
name: 'Munich',
billing_address: {
first_name: 'Anna', last_name: 'Muller', address1: 'Leopoldstr 1',
- city: 'Munich', postal_code: '80802', country_iso: germany.iso
+ city: 'Munich', postal_code: '80802', country_code: germany.iso
}
}, as: :json
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller_spec.rb
index 118a5cf27e..567cdd12de 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller_spec.rb
@@ -23,7 +23,7 @@ RSpec.describe Spree::Api::V3::Admin::Companies::TaxExemptionCertificatesControl
it 'lists the company certificates with whether each counts' do
create(:tax_exemption_certificate, :verified, company: company,
certificate_number: 'DE-1', reason_code: 'resale',
- country_iso: germany&.iso)
+ country_code: germany&.iso)
get :index, params: { company_id: company.prefixed_id }, as: :json
@@ -32,7 +32,7 @@ RSpec.describe Spree::Api::V3::Admin::Companies::TaxExemptionCertificatesControl
expect(row['id']).to start_with('cert_')
expect(row['certificate_number']).to eq('DE-1')
expect(row['status']).to eq('verified')
- expect(row['country_iso']).to eq('DE')
+ expect(row['country_code']).to eq('DE')
expect(row['active']).to be(true)
expect(row['can_be_deleted']).to be(false)
end
@@ -63,13 +63,13 @@ RSpec.describe Spree::Api::V3::Admin::Companies::TaxExemptionCertificatesControl
company_id: company.prefixed_id,
certificate_number: 'DE-RESALE-7',
reason_code: 'resale',
- country_iso: germany.iso
+ country_code: germany.iso
}, as: :json
expect(response).to have_http_status(:created)
expect(json_response['status']).to eq('pending')
- expect(json_response['country_iso']).to eq('DE')
- expect(company.tax_exemption_certificates.sole.country_iso).to eq(germany.iso)
+ expect(json_response['country_code']).to eq('DE')
+ expect(company.tax_exemption_certificates.sole.country_code).to eq(germany.iso)
end
it 'attaches a document from a direct upload' do
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/company_locations_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/company_locations_controller_spec.rb
index c633805f9e..3f3ad0bbeb 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/company_locations_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/company_locations_controller_spec.rb
@@ -64,7 +64,7 @@ RSpec.describe Spree::Api::V3::Admin::CompanyLocationsController, type: :control
id: location.prefixed_id,
billing_address: {
first_name: 'Anna', last_name: 'Muller', address1: 'Neue Str 5',
- city: 'Berlin', postal_code: '10115', country_iso: germany.iso
+ city: 'Berlin', postal_code: '10115', country_code: germany.iso
}
}, as: :json
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/customers/addresses_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/customers/addresses_controller_spec.rb
index eef53c4852..284a49d7bb 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/customers/addresses_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/customers/addresses_controller_spec.rb
@@ -47,7 +47,7 @@ RSpec.describe Spree::Api::V3::Admin::Customers::AddressesController, type: :con
address1: '123 Main St',
city: 'Brooklyn',
zipcode: '11201',
- country_iso: country.iso,
+ country_code: country.iso,
state_code: state.abbr,
phone: '+15551234567'
}
@@ -116,7 +116,7 @@ RSpec.describe Spree::Api::V3::Admin::Customers::AddressesController, type: :con
city: 'NewCity',
zipcode: address.zipcode,
phone: address.phone,
- country_iso: address.country_iso,
+ country_code: address.country_code,
state_code: address.state_code
}, as: :json
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/delivery_zones_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/delivery_zones_controller_spec.rb
index 4bb6e780ae..3571af5870 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/delivery_zones_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/delivery_zones_controller_spec.rb
@@ -26,8 +26,8 @@ RSpec.describe Spree::Api::V3::Admin::DeliveryZonesController, type: :controller
name: 'US North-East',
expand: 'members',
members: [
- { member_type: 'country', country_iso: 'US' },
- { member_type: 'postal_code', country_iso: 'US', postal_code_prefix: '10' }
+ { member_type: 'country', country_code: 'US' },
+ { member_type: 'postal_code', country_code: 'US', postal_code_prefix: '10' }
]
}, as: :json
@@ -51,7 +51,7 @@ RSpec.describe Spree::Api::V3::Admin::DeliveryZonesController, type: :controller
describe 'PATCH #update' do
let!(:zone) do
create(:delivery_zone, name: 'Domestic').tap do |z|
- z.members.create!(member_type: 'country', country_iso: country.iso)
+ z.members.create!(member_type: 'country', country_code: country.iso)
end
end
@@ -59,7 +59,7 @@ RSpec.describe Spree::Api::V3::Admin::DeliveryZonesController, type: :controller
patch :update, params: {
id: zone.prefixed_id,
name: 'Domestic v2',
- members: [{ member_type: 'postal_code', country_iso: 'US', postal_code_from: '10000', postal_code_to: '19999' }]
+ members: [{ member_type: 'postal_code', country_code: 'US', postal_code_from: '10000', postal_code_to: '19999' }]
}, as: :json
expect(response).to have_http_status(:ok)
@@ -109,18 +109,18 @@ RSpec.describe Spree::Api::V3::Admin::DeliveryZonesController, type: :controller
zone = create(:delivery_zone, store: store)
us = Spree::Country.by_iso('US')
de = Spree::Country.by_iso('DE')
- zone.members.create!(member_type: 'country', country_iso: us.iso)
- zone.members.create!(member_type: 'country', country_iso: de.iso)
+ zone.members.create!(member_type: 'country', country_code: us.iso)
+ zone.members.create!(member_type: 'country', country_code: de.iso)
get :show, params: { id: zone.prefixed_id, expand: 'members' }, as: :json
expect(response).to have_http_status(:ok)
members = json_response['members']
- expect(members.map { |member| member['country_iso'] }).to match_array(%w[US DE])
+ expect(members.map { |member| member['country_code'] }).to match_array(%w[US DE])
patch :update, params: {
id: zone.prefixed_id,
- members: members.map { |member| { member_type: member['member_type'], country_iso: member['country_iso'] } }
+ members: members.map { |member| { member_type: member['member_type'], country_code: member['country_code'] } }
}, as: :json
expect(response).to have_http_status(:ok)
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/orders/tax_lines_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/orders/tax_lines_controller_spec.rb
index a766265101..8e883af5a5 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/orders/tax_lines_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/orders/tax_lines_controller_spec.rb
@@ -25,14 +25,14 @@ RSpec.describe Spree::Api::V3::Admin::Orders::TaxLinesController, type: :control
end
it 'exposes the treatment, the jurisdiction and the provider payload' do
- tax_line.update!(taxability_reason: 'standard_rated', country_iso: 'DE',
+ tax_line.update!(taxability_reason: 'standard_rated', country_code: 'DE',
data: { 'jurisdictions' => [{ 'name' => 'DE', 'amount' => '1.5' }] })
get :index, params: { order_id: order.prefixed_id }, as: :json
row = json_response['data'].first
expect(row['taxability_reason']).to eq('standard_rated')
- expect(row['country_iso']).to eq('DE')
+ expect(row['country_code']).to eq('DE')
expect(row['state_code']).to be_nil
expect(row['data']['jurisdictions'].first['name']).to eq('DE')
expect(row['provider_id']).to eq('internal')
@@ -49,10 +49,10 @@ RSpec.describe Spree::Api::V3::Admin::Orders::TaxLinesController, type: :control
end
it 'filters by taxing country' do
- tax_line.update!(country_iso: 'DE')
- create(:tax_line, order: order, line_item: line_item, country_iso: 'FR')
+ tax_line.update!(country_code: 'DE')
+ create(:tax_line, order: order, line_item: line_item, country_code: 'FR')
- get :index, params: { order_id: order.prefixed_id, q: { country_iso_eq: 'DE' } }, as: :json
+ get :index, params: { order_id: order.prefixed_id, q: { country_code_eq: 'DE' } }, as: :json
expect(json_response['data'].map { |row| row['id'] }).to eq([tax_line.prefixed_id])
end
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/orders_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/orders_controller_spec.rb
index 5c5d307d00..35fcd1a048 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/orders_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/orders_controller_spec.rb
@@ -249,7 +249,7 @@ RSpec.describe Spree::Api::V3::Admin::OrdersController, type: :controller do
firstname: 'Jane', lastname: 'Doe',
address1: '350 Fifth Avenue', city: 'New York',
zipcode: '10118', phone: '555-555-0199',
- country_iso: country.iso, state_code: state.abbr
+ country_code: country.iso, state_code: state.abbr
}
}
end
@@ -351,7 +351,7 @@ RSpec.describe Spree::Api::V3::Admin::OrdersController, type: :controller do
firstname: 'Jane', lastname: 'Doe',
address1: '350 Fifth Avenue', city: 'New York',
zipcode: '10118', phone: '555-555-0199',
- country_iso: country.iso, state_code: state.abbr
+ country_code: country.iso, state_code: state.abbr
}
}
end
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/setup_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/setup_controller_spec.rb
index 0f5a512ab3..d85b6b5a88 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/setup_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/setup_controller_spec.rb
@@ -60,7 +60,7 @@ RSpec.describe Spree::Api::V3::Admin::SetupController, type: :controller do
it 'applies optional currency and country' do
- post :create, params: valid_params.merge(currency: 'eur', country_iso: 'us'), as: :json
+ post :create, params: valid_params.merge(currency: 'eur', country_code: 'us'), as: :json
expect(response).to have_http_status(:ok)
expect(@default_store.reload.default_currency).to eq('EUR')
@@ -70,7 +70,7 @@ RSpec.describe Spree::Api::V3::Admin::SetupController, type: :controller do
# An unknown country is refused before the token is spent, so the
# operator can correct the typo and try again.
it 'refuses an unknown country and leaves the token usable' do
- post :create, params: valid_params.merge(country_iso: 'ZZ'), as: :json
+ post :create, params: valid_params.merge(country_code: 'ZZ'), as: :json
expect(response).to have_http_status(:unprocessable_content)
expect(@default_store.reload.setup_token).to be_present
@@ -79,7 +79,7 @@ RSpec.describe Spree::Api::V3::Admin::SetupController, type: :controller do
# The token is spent in the same request, so persisting garbage here
# would be unrecoverable in-band — unknown codes are ignored, mirroring
- # country_iso.
+ # country_code.
it 'ignores an unknown currency' do
original_currency = @default_store.default_currency
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/stock_locations_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/stock_locations_controller_spec.rb
index 1746afbaa6..0535b5d448 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/stock_locations_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/stock_locations_controller_spec.rb
@@ -82,7 +82,7 @@ RSpec.describe Spree::Api::V3::Admin::StockLocationsController, type: :controlle
address1: '350 5th Ave',
city: 'New York',
zipcode: '10118',
- country_iso: country.iso,
+ country_code: country.iso,
kind: 'store',
pickup_enabled: true,
pickup_stock_policy: 'local',
@@ -106,14 +106,14 @@ RSpec.describe Spree::Api::V3::Admin::StockLocationsController, type: :controlle
)
end
- it 'resolves country_iso and state_code to the right associations' do
+ it 'resolves country_code and state_code to the right associations' do
state = Spree::State.resolve(country.iso, 'NY')
post :create, params: valid_params.merge(state_code: state.abbr), as: :json
expect(response).to have_http_status(:created)
created = Spree::StockLocation.find_by_prefix_id!(json_response['id'])
- expect(created.country_iso).to eq(country.iso)
+ expect(created.country_code).to eq(country.iso)
expect(created.state_code).to eq(state.abbr)
end
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/tax_rates_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/tax_rates_controller_spec.rb
index ed55d17c5c..865ddf58b4 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/tax_rates_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/tax_rates_controller_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe Spree::Api::V3::Admin::TaxRatesController, type: :controller do
let!(:tax_category) { create(:tax_category) }
let!(:germany) { Spree::Country.by_iso('DE') }
- let!(:tax_rate) { create(:tax_rate, tax_category: tax_category, country_iso: germany&.iso, amount: 0.19, included_in_price: true) }
+ let!(:tax_rate) { create(:tax_rate, tax_category: tax_category, country_code: germany&.iso, amount: 0.19, included_in_price: true) }
before { request.headers.merge!(headers) }
@@ -34,7 +34,7 @@ RSpec.describe Spree::Api::V3::Admin::TaxRatesController, type: :controller do
expect(json_response['amount_percentage']).to eq(19.0)
expect(json_response['included_in_price']).to be(true)
expect(json_response['tax_category_id']).to eq(tax_category.prefixed_id)
- expect(json_response['country_iso']).to eq('DE')
+ expect(json_response['country_code']).to eq('DE')
expect(json_response['state_code']).to be_nil
expect(json_response['state_code']).to be_nil
expect(json_response['store_id']).to eq(@default_store.prefixed_id)
@@ -44,7 +44,7 @@ RSpec.describe Spree::Api::V3::Admin::TaxRatesController, type: :controller do
describe 'POST #create' do
let(:create_params) do
{ name: 'German VAT', amount: 0.19, included_in_price: true,
- tax_category_id: tax_category.prefixed_id, country_iso: 'DE' }
+ tax_category_id: tax_category.prefixed_id, country_code: 'DE' }
end
it 'creates a rate bound to the current store' do
@@ -71,10 +71,10 @@ RSpec.describe Spree::Api::V3::Admin::TaxRatesController, type: :controller do
end
it 'stores the jurisdiction upcased however it was sent' do
- post :create, params: create_params.merge(country_iso: 'de', state_code: 'be'), as: :json
+ post :create, params: create_params.merge(country_code: 'de', state_code: 'be'), as: :json
expect(response).to have_http_status(:created)
- expect(json_response['country_iso']).to eq('DE')
+ expect(json_response['country_code']).to eq('DE')
expect(json_response['state_code']).to eq('BE')
end
diff --git a/spree/api/spec/controllers/spree/api/v3/store/carts_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/store/carts_controller_spec.rb
index ee374533f9..6cb5fc5005 100644
--- a/spree/api/spec/controllers/spree/api/v3/store/carts_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/store/carts_controller_spec.rb
@@ -724,7 +724,7 @@ RSpec.describe Spree::Api::V3::Store::CartsController, type: :controller do
shipping_address: {
first_name: 'John', last_name: 'Doe',
address1: '123 Main St', city: 'New York',
- postal_code: '10001', country_iso: 'US', state_code: 'NY',
+ postal_code: '10001', country_code: 'US', state_code: 'NY',
phone: '555-1234'
}
}
@@ -738,7 +738,7 @@ RSpec.describe Spree::Api::V3::Store::CartsController, type: :controller do
{
first_name: 'Buyer', last_name: 'McGee',
address1: '1 Test St', city: 'New York',
- postal_code: '10001', country_iso: 'US', state_code: 'NY',
+ postal_code: '10001', country_code: 'US', state_code: 'NY',
phone: '555-0100'
}
end
diff --git a/spree/api/spec/controllers/spree/api/v3/store/customer/addresses_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/store/customer/addresses_controller_spec.rb
index ca6e95a2ce..a0c91c4e8b 100644
--- a/spree/api/spec/controllers/spree/api/v3/store/customer/addresses_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/store/customer/addresses_controller_spec.rb
@@ -96,7 +96,7 @@ RSpec.describe Spree::Api::V3::Store::Customer::AddressesController, type: :cont
city: 'New York',
postal_code: Spree::TestingSupport::CountryPool.postal_code_for(country.iso),
phone: '555-1234',
- country_iso: country.iso,
+ country_code: country.iso,
state_code: state.abbr
}
end
@@ -219,7 +219,7 @@ RSpec.describe Spree::Api::V3::Store::Customer::AddressesController, type: :cont
city: 'Chicago',
postal_code: Spree::TestingSupport::CountryPool.postal_code_for(country.iso),
phone: '555-9999',
- country_iso: country.iso,
+ country_code: country.iso,
state_code: state.abbr
}
end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/companies/locations_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/companies/locations_spec.rb
index b3b891e343..74c36e592c 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/companies/locations_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/companies/locations_spec.rb
@@ -60,7 +60,7 @@ RSpec.describe 'Admin Company Locations API', type: :request, swagger_doc: 'api-
properties: {
first_name: { type: :string }, last_name: { type: :string },
address1: { type: :string }, city: { type: :string },
- postal_code: { type: :string }, country_iso: { type: :string, example: 'DE' }
+ postal_code: { type: :string }, country_code: { type: :string, example: 'DE' }
}
}
},
@@ -75,7 +75,7 @@ RSpec.describe 'Admin Company Locations API', type: :request, swagger_doc: 'api-
name: 'Hamburg warehouse',
billing_address: {
first_name: 'Anna', last_name: 'Muller', address1: 'Hafenstr 1',
- city: 'Hamburg', postal_code: '20095', country_iso: germany.iso
+ city: 'Hamburg', postal_code: '20095', country_code: germany.iso
}
}
end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/companies/tax_exemption_certificates_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/companies/tax_exemption_certificates_spec.rb
index 5035a73144..19baf7ed1b 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/companies/tax_exemption_certificates_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/companies/tax_exemption_certificates_spec.rb
@@ -59,7 +59,7 @@ RSpec.describe 'Admin Tax Exemption Certificates API', type: :request, swagger_d
Records exemption evidence against a business. Certificates start `pending` and exempt nothing
until verified.
- `country_iso` and `state_code` say where the certificate holds — omit both for one valid
+ `country_code` and `state_code` say where the certificate holds — omit both for one valid
everywhere, give only the country for one valid throughout it. `document` takes an ActiveStorage
signed blob id obtained from `POST /api/v3/admin/direct_uploads`.
DESC
@@ -72,7 +72,7 @@ RSpec.describe 'Admin Tax Exemption Certificates API', type: :request, swagger_d
properties: {
certificate_number: { type: :string, example: 'DE-RESALE-7' },
reason_code: { type: :string, description: 'Becomes the tax provider\'s entity use code.', example: 'resale' },
- country_iso: { type: :string, nullable: true, example: 'DE' },
+ country_code: { type: :string, nullable: true, example: 'DE' },
state_code: { type: :string, nullable: true, example: 'BE' },
expires_at: { type: :string, format: 'date-time', nullable: true },
issuing_authority: { type: :string, nullable: true, example: 'Finanzamt Berlin' },
@@ -90,7 +90,7 @@ RSpec.describe 'Admin Tax Exemption Certificates API', type: :request, swagger_d
{
certificate_number: 'DE-RESALE-7',
reason_code: 'resale',
- country_iso: germany.iso,
+ country_code: germany.iso,
document: pdf_blob.signed_id
}
end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/customers/addresses_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/customers/addresses_spec.rb
index f110d0a918..549d0f7b82 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/customers/addresses_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/customers/addresses_spec.rb
@@ -63,7 +63,7 @@ RSpec.describe 'Admin Customer Addresses API', type: :request, swagger_doc: 'api
address2: { type: :string },
city: { type: :string },
postal_code: { type: :string },
- country_iso: { type: :string, description: 'ISO-2 country code (e.g. US)' },
+ country_code: { type: :string, description: 'ISO-2 country code (e.g. US)' },
state_code: { type: :string, description: 'State/province abbreviation (e.g. NY)' },
phone: { type: :string },
company: { type: :string },
@@ -79,7 +79,7 @@ RSpec.describe 'Admin Customer Addresses API', type: :request, swagger_doc: 'api
{
first_name: 'Jane', last_name: 'Doe',
address1: '350 Fifth Avenue', city: 'New York', postal_code: '10118',
- country_iso: 'US', state_code: 'NY', phone: '+12125551234',
+ country_code: 'US', state_code: 'NY', phone: '+12125551234',
label: 'Office'
}
end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/delivery_settings_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/delivery_settings_spec.rb
index 8dbbaa65b0..e5830028db 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/delivery_settings_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/delivery_settings_spec.rb
@@ -130,7 +130,7 @@ RSpec.describe 'Admin Delivery Settings API', type: :request, swagger_doc: 'api-
type: :object,
properties: {
member_type: { type: :string, enum: %w[country state postal_code] },
- country_iso: { type: :string, nullable: true, example: 'US' },
+ country_code: { type: :string, nullable: true, example: 'US' },
state_code: { type: :string, nullable: true },
postal_code_prefix: { type: :string, nullable: true },
postal_code_from: { type: :string, nullable: true },
@@ -151,8 +151,8 @@ RSpec.describe 'Admin Delivery Settings API', type: :request, swagger_doc: 'api-
{
name: 'US North-East',
members: [
- { member_type: 'country', country_iso: 'US' },
- { member_type: 'postal_code', country_iso: 'US', postal_code_prefix: '10' }
+ { member_type: 'country', country_code: 'US' },
+ { member_type: 'postal_code', country_code: 'US', postal_code_prefix: '10' }
]
}
end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/markets_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/markets_spec.rb
index d91aa25ebc..7f239c9416 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/markets_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/markets_spec.rb
@@ -62,7 +62,7 @@ RSpec.describe 'Admin Markets API', type: :request, swagger_doc: 'api-reference/
description <<~DESC
Creates a new market for the current store.
- - `country_isos` accepts 2-letter ISO country codes (e.g. `["DE", "FR"]`);
+ - `country_codes` accepts 2-letter ISO country codes (e.g. `["DE", "FR"]`);
the market must contain at least one country. Unknown codes are
silently dropped.
- `supported_locales` accepts an array of locale codes; the
@@ -91,14 +91,14 @@ RSpec.describe 'Admin Markets API', type: :request, swagger_doc: 'api-reference/
tax_inclusive: { type: :boolean, default: false, description: 'Display prices with tax included.' },
default: { type: :boolean, default: false, description: 'Setting to true demotes the previous default.' },
position: { type: :integer, description: 'Sort order within the store; lower = first.' },
- country_isos: {
+ country_codes: {
type: :array,
items: { type: :string },
description: '2-letter ISO country codes assigned to this market. At least one is required.',
example: %w[DE FR]
}
},
- required: %w[name currency default_locale country_isos]
+ required: %w[name currency default_locale country_codes]
}
response '201', 'market created' do
@@ -110,7 +110,7 @@ RSpec.describe 'Admin Markets API', type: :request, swagger_doc: 'api-reference/
default_locale: 'fr',
supported_locales: ['fr', 'en'],
tax_inclusive: true,
- country_isos: [other_country.iso]
+ country_codes: [other_country.iso]
}
end
@@ -122,7 +122,7 @@ RSpec.describe 'Admin Markets API', type: :request, swagger_doc: 'api-reference/
expect(data['currency']).to eq('EUR')
expect(data['tax_inclusive']).to be true
expect(data['supported_locales']).to match_array(%w[en fr])
- expect(data['country_isos']).to eq(['FR'])
+ expect(data['country_codes']).to eq(['FR'])
end
end
@@ -180,7 +180,7 @@ RSpec.describe 'Admin Markets API', type: :request, swagger_doc: 'api-reference/
produces 'application/json'
security [api_key: [], bearer_auth: []]
description <<~DESC
- Updates an existing market. Pass `country_isos` to replace the
+ Updates an existing market. Pass `country_codes` to replace the
market's country list (full-set update), `supported_locales` to
replace the supported locales, or `position` to reorder the market
within the store.
@@ -203,7 +203,7 @@ RSpec.describe 'Admin Markets API', type: :request, swagger_doc: 'api-reference/
tax_inclusive: { type: :boolean },
default: { type: :boolean },
position: { type: :integer },
- country_isos: { type: :array, items: { type: :string } }
+ country_codes: { type: :array, items: { type: :string } }
}
}
diff --git a/spree/api/spec/integration/spree/api/v3/admin/orders_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/orders_spec.rb
index dd7a45d8fa..a7e8a3b03d 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/orders_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/orders_spec.rb
@@ -105,7 +105,7 @@ RSpec.describe 'Admin Orders API', type: :request, swagger_doc: 'api-reference/a
properties: {
first_name: { type: :string }, last_name: { type: :string },
address1: { type: :string }, city: { type: :string },
- postal_code: { type: :string }, country_iso: { type: :string },
+ postal_code: { type: :string }, country_code: { type: :string },
state_code: { type: :string }, phone: { type: :string }
}
},
@@ -115,7 +115,7 @@ RSpec.describe 'Admin Orders API', type: :request, swagger_doc: 'api-reference/a
properties: {
first_name: { type: :string }, last_name: { type: :string },
address1: { type: :string }, city: { type: :string },
- postal_code: { type: :string }, country_iso: { type: :string },
+ postal_code: { type: :string }, country_code: { type: :string },
state_code: { type: :string }, phone: { type: :string }
}
},
@@ -239,7 +239,7 @@ RSpec.describe 'Admin Orders API', type: :request, swagger_doc: 'api-reference/a
address1: { type: :string },
city: { type: :string },
zipcode: { type: :string },
- country_iso: { type: :string },
+ country_code: { type: :string },
state_code: { type: :string },
phone: { type: :string }
}
@@ -252,7 +252,7 @@ RSpec.describe 'Admin Orders API', type: :request, swagger_doc: 'api-reference/a
address1: { type: :string },
city: { type: :string },
zipcode: { type: :string },
- country_iso: { type: :string },
+ country_code: { type: :string },
state_code: { type: :string },
phone: { type: :string }
}
diff --git a/spree/api/spec/integration/spree/api/v3/admin/setup_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/setup_spec.rb
index 56e3ced93e..4332ce0827 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/setup_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/setup_spec.rb
@@ -45,7 +45,7 @@ RSpec.describe 'Admin Setup API', type: :request, swagger_doc: 'api-reference/ad
last_name: { type: :string, example: 'Owner' },
store_name: { type: :string, example: 'My Store' },
currency: { type: :string, description: 'ISO currency code for the store.', example: 'USD' },
- country_iso: { type: :string, description: 'ISO 3166-1 alpha-2 country code for the store.', example: 'US' }
+ country_code: { type: :string, description: 'ISO 3166-1 alpha-2 country code for the store.', example: 'US' }
}
}
diff --git a/spree/api/spec/integration/spree/api/v3/admin/stock_locations_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/stock_locations_spec.rb
index d97b209f2d..c66483f53a 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/stock_locations_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/stock_locations_spec.rb
@@ -108,7 +108,7 @@ RSpec.describe 'Admin Stock Locations API', type: :request, swagger_doc: 'api-re
zipcode: { type: :string, nullable: true },
phone: { type: :string, nullable: true },
company: { type: :string, nullable: true },
- country_iso: { type: :string, nullable: true, description: 'ISO-3166 alpha-2 country code (e.g. "US").' },
+ country_code: { type: :string, nullable: true, description: 'ISO-3166 alpha-2 country code (e.g. "US").' },
state_code: { type: :string, nullable: true, description: 'State / province abbreviation (e.g. "NY"). Resolved against the selected country.' },
state_name: { type: :string, nullable: true, description: 'Free-text state for countries without a states list.' },
pickup_enabled: { type: :boolean },
@@ -230,7 +230,7 @@ RSpec.describe 'Admin Stock Locations API', type: :request, swagger_doc: 'api-re
zipcode: { type: :string, nullable: true },
phone: { type: :string, nullable: true },
company: { type: :string, nullable: true },
- country_iso: { type: :string, nullable: true },
+ country_code: { type: :string, nullable: true },
state_code: { type: :string, nullable: true },
state_name: { type: :string, nullable: true },
pickup_enabled: { type: :boolean },
diff --git a/spree/api/spec/integration/spree/api/v3/admin/tax_rates_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/tax_rates_spec.rb
index d91a6513a0..b71b57576d 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/tax_rates_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/tax_rates_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe 'Admin Tax Rates API', type: :request, swagger_doc: 'api-referenc
let!(:tax_category) { create(:tax_category) }
let!(:germany) { Spree::Country.by_iso('DE') }
- let!(:tax_rate) { create(:tax_rate, tax_category: tax_category, country_iso: germany&.iso, amount: 0.19, included_in_price: true) }
+ let!(:tax_rate) { create(:tax_rate, tax_category: tax_category, country_code: germany&.iso, amount: 0.19, included_in_price: true) }
let(:Authorization) { "Bearer #{admin_jwt_token}" }
path '/api/v3/admin/tax_rates' do
@@ -69,7 +69,7 @@ RSpec.describe 'Admin Tax Rates API', type: :request, swagger_doc: 'api-referenc
Creates a tax rate for the current store. Give either `amount` as a
decimal (`0.19`) or `amount_percentage` as a percentage (`19`).
- Name the jurisdiction with `country_iso` (and `state_code` for a
+ Name the jurisdiction with `country_code` (and `state_code` for a
state-level rate). Omitting the country makes the rate apply everywhere.
Set `included_in_price` for VAT-style pricing, where the rate is backed
@@ -89,7 +89,7 @@ RSpec.describe 'Admin Tax Rates API', type: :request, swagger_doc: 'api-referenc
included_in_price: { type: :boolean },
show_rate_in_label: { type: :boolean },
tax_category_id: { type: :string },
- country_iso: { type: :string, description: 'ISO code, e.g. "DE". Omit for every country.' },
+ country_code: { type: :string, description: 'ISO code, e.g. "DE". Omit for every country.' },
state_code: { type: :string, description: 'State abbreviation within that country, e.g. "CA".' }
},
required: %w[name tax_category_id]
@@ -99,7 +99,7 @@ RSpec.describe 'Admin Tax Rates API', type: :request, swagger_doc: 'api-referenc
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
let(:body) do
{ name: 'VAT', amount_percentage: 19, included_in_price: true,
- tax_category_id: tax_category.prefixed_id, country_iso: 'DE' }
+ tax_category_id: tax_category.prefixed_id, country_code: 'DE' }
end
schema '$ref' => '#/components/schemas/TaxRate'
@@ -165,7 +165,7 @@ RSpec.describe 'Admin Tax Rates API', type: :request, swagger_doc: 'api-referenc
included_in_price: { type: :boolean },
show_rate_in_label: { type: :boolean },
tax_category_id: { type: :string },
- country_iso: { type: :string },
+ country_code: { type: :string },
state_code: { type: :string }
}
}
diff --git a/spree/api/spec/integration/spree/api/v3/store/addresses_spec.rb b/spree/api/spec/integration/spree/api/v3/store/addresses_spec.rb
index 46d1c3e60d..84d4bc7bed 100644
--- a/spree/api/spec/integration/spree/api/v3/store/addresses_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/store/addresses_spec.rb
@@ -73,13 +73,13 @@ RSpec.describe 'Addresses API', type: :request, swagger_doc: 'api-reference/stor
postal_code: { type: :string, example: '10001' },
phone: { type: :string, example: '+1 555 123 4567' },
company: { type: :string, example: 'Acme Inc' },
- country_iso: { type: :string, example: 'US', description: 'ISO 3166-1 alpha-2 country code (e.g., "US", "DE")' },
+ country_code: { type: :string, example: 'US', description: 'ISO 3166-1 alpha-2 country code (e.g., "US", "DE")' },
state_code: { type: :string, example: 'NY', description: 'ISO 3166-2 subdivision code without country prefix (e.g., "CA", "NY")' },
state_name: { type: :string, example: 'New York', description: 'State name - for countries without predefined states' },
is_default_billing: { type: :boolean, example: true, description: 'Set as default billing address' },
is_default_shipping: { type: :boolean, example: true, description: 'Set as default shipping address' }
},
- required: %w[first_name last_name address1 city postal_code country_iso]
+ required: %w[first_name last_name address1 city postal_code country_code]
}
response '201', 'address created' do
@@ -93,7 +93,7 @@ RSpec.describe 'Addresses API', type: :request, swagger_doc: 'api-reference/stor
city: 'New York',
postal_code: '10001',
phone: '+1 555 123 4567',
- country_iso: country.iso,
+ country_code: country.iso,
state_code: state.abbr
}
end
@@ -104,7 +104,7 @@ RSpec.describe 'Addresses API', type: :request, swagger_doc: 'api-reference/stor
data = JSON.parse(response.body)
expect(data['first_name']).to eq('John')
expect(data['city']).to eq('New York')
- expect(data['country_iso']).to eq(country.iso)
+ expect(data['country_code']).to eq(country.iso)
expect(data['state_code']).to eq(state.abbr)
end
end
diff --git a/spree/api/spec/integration/spree/api/v3/store/carts_spec.rb b/spree/api/spec/integration/spree/api/v3/store/carts_spec.rb
index e9f1635487..6d854f0058 100644
--- a/spree/api/spec/integration/spree/api/v3/store/carts_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/store/carts_spec.rb
@@ -207,7 +207,7 @@ RSpec.describe 'Carts API', type: :request, swagger_doc: 'api-reference/store.ya
address1: { type: :string }, address2: { type: :string },
city: { type: :string }, postal_code: { type: :string },
phone: { type: :string }, company: { type: :string },
- country_iso: { type: :string }, state_code: { type: :string }
+ country_code: { type: :string }, state_code: { type: :string }
}
},
shipping_address: {
@@ -217,7 +217,7 @@ RSpec.describe 'Carts API', type: :request, swagger_doc: 'api-reference/store.ya
address1: { type: :string }, address2: { type: :string },
city: { type: :string }, postal_code: { type: :string },
phone: { type: :string }, company: { type: :string },
- country_iso: { type: :string }, state_code: { type: :string }
+ country_code: { type: :string }, state_code: { type: :string }
}
}
}
diff --git a/spree/api/spec/requests/spree/api/v3/admin/tax_configuration_spec.rb b/spree/api/spec/requests/spree/api/v3/admin/tax_configuration_spec.rb
index 73fa2795e9..9515349c3e 100644
--- a/spree/api/spec/requests/spree/api/v3/admin/tax_configuration_spec.rb
+++ b/spree/api/spec/requests/spree/api/v3/admin/tax_configuration_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe 'Admin tax configuration', type: :request do
it 'configures a rate and produces the tax it describes' do
post '/api/v3/admin/tax_rates',
params: { name: 'German VAT', amount_percentage: 19, included_in_price: true,
- tax_category_id: tax_category.prefixed_id, country_iso: 'DE' },
+ tax_category_id: tax_category.prefixed_id, country_code: 'DE' },
headers: headers, as: :json
expect(response).to have_http_status(:created)
@@ -35,7 +35,7 @@ RSpec.describe 'Admin tax configuration', type: :request do
Spree::Carts::RecalculateTotals.call(cart: cart)
- expect(cart.tax_lines.reload.pluck(:amount, :taxability_reason, :country_iso, :provider_id)).to eq(
+ expect(cart.tax_lines.reload.pluck(:amount, :taxability_reason, :country_code, :provider_id)).to eq(
[[BigDecimal('1.6'), 'standard_rated', 'DE', 'internal']]
)
end
@@ -43,7 +43,7 @@ RSpec.describe 'Admin tax configuration', type: :request do
it 'still records a treatment when the rate is zero' do
post '/api/v3/admin/tax_rates',
params: { name: 'German VAT', amount_percentage: 19, included_in_price: true,
- tax_category_id: tax_category.prefixed_id, country_iso: 'DE' },
+ tax_category_id: tax_category.prefixed_id, country_code: 'DE' },
headers: headers, as: :json
rate_id = JSON.parse(response.body)['id']
@@ -62,7 +62,7 @@ RSpec.describe 'Admin tax configuration', type: :request do
it 'shows the storefront the tax on a line, without the admin treatment fields' do
post '/api/v3/admin/tax_rates',
params: { name: 'German VAT', amount_percentage: 19, included_in_price: true,
- tax_category_id: tax_category.prefixed_id, country_iso: 'DE' },
+ tax_category_id: tax_category.prefixed_id, country_code: 'DE' },
headers: headers, as: :json
Spree::Carts::RecalculateTotals.call(cart: cart)
@@ -76,6 +76,6 @@ RSpec.describe 'Admin tax configuration', type: :request do
expect(tax_lines.first).to include('label', 'rate', 'amount', 'included')
expect(tax_lines.first['included']).to be(true)
expect(tax_lines.first).not_to have_key('taxability_reason')
- expect(tax_lines.first).not_to have_key('country_iso')
+ expect(tax_lines.first).not_to have_key('country_code')
end
end
diff --git a/spree/api/spec/requests/spree/api/v3/store/tax_identifiers_spec.rb b/spree/api/spec/requests/spree/api/v3/store/tax_identifiers_spec.rb
index 1411f71368..7f10f66a6d 100644
--- a/spree/api/spec/requests/spree/api/v3/store/tax_identifiers_spec.rb
+++ b/spree/api/spec/requests/spree/api/v3/store/tax_identifiers_spec.rb
@@ -131,7 +131,7 @@ RSpec.describe 'Store tax identifiers', type: :request do
describe 'the re-costing it triggers' do
let(:line_item) { cart.line_items.first }
let!(:tax_rate) do
- create(:tax_rate, store: store, country_iso: cart.tax_country&.iso,
+ create(:tax_rate, store: store, country_code: cart.tax_country&.iso,
tax_category: line_item.tax_category, amount: 0.1, included_in_price: false)
end
diff --git a/spree/api/spec/serializers/spree/api/v3/delivery_rate_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/delivery_rate_serializer_spec.rb
index 0ea9bb9d8c..edbce9fea3 100644
--- a/spree/api/spec/serializers/spree/api/v3/delivery_rate_serializer_spec.rb
+++ b/spree/api/spec/serializers/spree/api/v3/delivery_rate_serializer_spec.rb
@@ -77,7 +77,7 @@ RSpec.describe Spree::Api::V3::DeliveryRateSerializer do
end
context 'with included tax' do
- let(:tax_rate) { create(:tax_rate, amount: 0.1, included_in_price: true, country_iso: @default_country&.iso) }
+ let(:tax_rate) { create(:tax_rate, amount: 0.1, included_in_price: true, country_code: @default_country&.iso) }
before { shipping_rate.update!(tax_rate: tax_rate) }
diff --git a/spree/core/README.md b/spree/core/README.md
index 5ec0ca9b17..d611357a2e 100644
--- a/spree/core/README.md
+++ b/spree/core/README.md
@@ -87,7 +87,7 @@ Configure Spree in an initializer:
# config/initializers/spree.rb
Spree.config do |config|
config.currency = 'USD'
- config.default_country_iso = 'US'
+ config.default_country_code = 'US'
end
```
diff --git a/spree/core/app/models/concerns/spree/has_iso_geography.rb b/spree/core/app/models/concerns/spree/has_iso_geography.rb
index 6faa459449..514c98e860 100644
--- a/spree/core/app/models/concerns/spree/has_iso_geography.rb
+++ b/spree/core/app/models/concerns/spree/has_iso_geography.rb
@@ -1,6 +1,6 @@
module Spree
# Geography as reference data (docs/plans/6.0-drop-country-state-models.md):
- # a model stores ISO codes — `country_iso`, and `state_code` where
+ # a model stores ISO codes — `country_code`, and `state_code` where
# subdivisions matter — and reads them back as {Spree::Country} /
# {Spree::State} value objects.
#
@@ -23,24 +23,24 @@ module Spree
class_methods do
# @param state [Boolean] whether the model also carries a `state_code` column
def has_iso_geography(state: true)
- normalizes :country_iso, with: UPCASE
+ normalizes :country_code, with: UPCASE
# @return [Spree::Country, nil]
define_method(:country) do
- Spree::Country.by_iso(country_iso) if country_iso.present?
+ Spree::Country.by_iso(country_code) if country_code.present?
end
# A code nothing recognises is rejected rather than stored: every
# consumer matches codes verbatim, so a bad one silently matches
# nothing. Gated on change so historical rows stay updatable even if
# the registry's curation shifts under them.
- validate :country_iso_must_resolve, if: -> { new_record? || will_save_change_to_country_iso? }
- define_method(:country_iso_must_resolve) do
- return if country_iso.blank?
+ validate :country_code_must_resolve, if: -> { new_record? || will_save_change_to_country_code? }
+ define_method(:country_code_must_resolve) do
+ return if country_code.blank?
- errors.add(:country_iso, :invalid) if Spree::Country.by_iso(country_iso).nil?
+ errors.add(:country_code, :invalid) if Spree::Country.by_iso(country_code).nil?
end
- private :country_iso_must_resolve
+ private :country_code_must_resolve
return unless state
@@ -48,7 +48,7 @@ module Spree
# @return [Spree::State, nil]
define_method(:state) do
- Spree::State.resolve(country_iso, state_code) if country_iso.present? && state_code.present?
+ Spree::State.resolve(country_code, state_code) if country_code.present? && state_code.present?
end
# A subdivision code is only meaningful within its country, so it is
@@ -56,13 +56,13 @@ module Spree
# through their successors). Without a country there is nothing to
# check against — the code is left alone.
validate :state_code_must_resolve,
- if: -> { new_record? || will_save_change_to_state_code? || will_save_change_to_country_iso? }
+ if: -> { new_record? || will_save_change_to_state_code? || will_save_change_to_country_code? }
define_method(:state_code_must_resolve) do
- return if state_code.blank? || country_iso.blank?
+ return if state_code.blank? || country_code.blank?
# An unresolvable country already got its own error.
- return if Spree::Country.by_iso(country_iso).nil?
+ return if Spree::Country.by_iso(country_code).nil?
- errors.add(:state_code, :invalid) if Spree::IsoData.subdivision_code(country_iso, state_code).nil?
+ errors.add(:state_code, :invalid) if Spree::IsoData.subdivision_code(country_code, state_code).nil?
end
private :state_code_must_resolve
end
diff --git a/spree/core/app/models/concerns/spree/preference_schema.rb b/spree/core/app/models/concerns/spree/preference_schema.rb
index 02d10f148e..bec9dff250 100644
--- a/spree/core/app/models/concerns/spree/preference_schema.rb
+++ b/spree/core/app/models/concerns/spree/preference_schema.rb
@@ -102,7 +102,7 @@ module Spree
#
# When `klass` is nil, prefixed-ID decoding is skipped — used for
# ISO/string-keyed preferences where the value is the identifier
- # (e.g. country `:country_isos`).
+ # (e.g. country `:country_codes`).
#
# When `scope:` is given, the existence check runs through the
# scope relation derived from the owning record — prevents a
diff --git a/spree/core/app/models/concerns/spree/stores/markets.rb b/spree/core/app/models/concerns/spree/stores/markets.rb
index e7f2f73add..5b3af1944e 100644
--- a/spree/core/app/models/concerns/spree/stores/markets.rb
+++ b/spree/core/app/models/concerns/spree/stores/markets.rb
@@ -17,20 +17,26 @@ module Spree
if has_markets?
default_market&.default_country
else
- Spree::Country.by_iso(read_attribute(:default_country_iso_code))
+ Spree::Country.by_iso(read_attribute(:default_country_code))
end
end
# Returns the default country's ISO code, derived from the default market
# @return [String, nil]
- def default_country_iso_code
+ def default_country_code
if has_markets?
default_country&.iso
else
- read_attribute(:default_country_iso_code)
+ read_attribute(:default_country_code)
end
end
+ # @deprecated Use +default_country_code+. Removed in 6.1.
+ def default_country_iso_code
+ Spree::Deprecation.warn('Spree::Store#default_country_iso_code is deprecated, use #default_country_code instead')
+ default_country_code
+ end
+
# Returns the default locale, delegating to the default market when markets exist
# Falls back to the store's own default_locale column
# @return [String, nil]
@@ -63,11 +69,11 @@ module Spree
# Returns the countries covered by this store's markets, by name
# @return [Array<Spree::Country>]
def countries_from_markets
- isos = Spree::MarketCountry.joins(:market).
- where(Spree::Market.table_name => { store_id: id, deleted_at: nil }).
- distinct.pluck(:country_iso)
+ codes = Spree::MarketCountry.joins(:market).
+ where(Spree::Market.table_name => { store_id: id, deleted_at: nil }).
+ distinct.pluck(:country_code)
- isos.filter_map { |iso| Spree::Country.by_iso(iso) }.sort_by(&:name)
+ codes.filter_map { |code| Spree::Country.by_iso(code) }.sort_by(&:name)
end
# Returns the countries available for checkout, derived from markets
@@ -130,7 +136,7 @@ module Spree
return if markets.exists?
country = @default_country_for_market ||
- Spree::Country.by_iso(read_attribute(:default_country_iso_code)) ||
+ Spree::Country.by_iso(read_attribute(:default_country_code)) ||
Spree::Country.by_iso('US')
iso_country = ISO3166::Country[country.iso]
diff --git a/spree/core/app/models/spree/address.rb b/spree/core/app/models/spree/address.rb
index 617d32101d..1ac540daf8 100644
--- a/spree/core/app/models/spree/address.rb
+++ b/spree/core/app/models/spree/address.rb
@@ -47,9 +47,11 @@ module Spree
has_iso_geography
- # @deprecated The canonical name is +state_code+, matching the tax tables.
- # Kept because the Store API shipped +state_abbr+; removed in 6.1.
+ # @deprecated The canonical names are +country_code+ and +state_code+,
+ # matching the tax tables. Kept because the Store API shipped
+ # +country_iso+ and +state_abbr+; both are removed in 6.1.
alias_attribute :state_abbr, :state_code
+ alias_attribute :country_iso, :country_code
# we need a safe operator here as Address is added to custom_field_enabled_resources in Engine
belongs_to :customer, class_name: Spree.customer_class&.name, optional: true, touch: true
@@ -127,16 +129,18 @@ module Spree
params.delete(:country_id)
params.delete(:state_id)
- # The API still speaks state_abbr; the column is state_code.
+ # Legacy write names accepted until 6.1; the columns are country_code
+ # and state_code.
params[:state_code] = params.delete(:state_abbr) if params.key?(:state_abbr)
+ params[:country_code] = params.delete(:country_iso) if params.key?(:country_iso)
- country_iso = params[:country_iso].presence&.to_s&.upcase
- params[:country_iso] = country_iso if country_iso
+ country_code = params[:country_code].presence&.to_s&.upcase
+ params[:country_code] = country_code if country_code
if params[:state_code].present?
params[:state_code] = params[:state_code].to_s.upcase
- elsif country_iso && params[:state_name].present?
- matched = Spree::IsoData.subdivision_code(country_iso, params[:state_name])
+ elsif country_code && params[:state_name].present?
+ matched = Spree::IsoData.subdivision_code(country_code, params[:state_name])
if matched
params[:state_code] = matched
@@ -147,7 +151,7 @@ module Spree
params
end
- self.whitelisted_ransackable_attributes = ADDRESS_FIELDS + %w[country_iso state_code]
+ self.whitelisted_ransackable_attributes = ADDRESS_FIELDS + %w[country_code state_code]
self.whitelisted_ransackable_associations = %w[customer]
def self.required_fields
@@ -214,7 +218,7 @@ module Spree
# A country alone doesn't make an address — a new one is pre-filled with the
# store's default, so both the code and the association are ignored here.
def empty?
- attributes.except('id', 'created_at', 'updated_at', 'country_id', 'country_iso').all? { |_, v| v.nil? }
+ attributes.except('id', 'created_at', 'updated_at', 'country_id', 'country_code').all? { |_, v| v.nil? }
end
# Generates an address hash for payment gateway options
@@ -309,7 +313,7 @@ module Spree
def should_geocode?
Spree::Config[:geocode_addresses] && (
saved_changes.key?(:address1) || saved_changes.key?(:city) ||
- saved_changes.key?(:state_code) || saved_changes.key?(:country_iso)
+ saved_changes.key?(:state_code) || saved_changes.key?(:country_code)
)
end
@@ -323,14 +327,14 @@ module Spree
# with it for the one release it still exists. Assigning +country+ directly
# is equally supported — whichever half was set fills in the other.
def normalize_country
- submitted_iso = self[:country_iso].presence
+ submitted_iso = self[:country_code].presence
return if submitted_iso.blank?
resolved = Spree::Country.by_iso(submitted_iso)
# Alpha-3 codes arrive here too; the column stores alpha-2. An
# unrecognised code is left in place — the presence validation on
# +country+ reports it.
- self[:country_iso] = resolved.iso if resolved
+ self[:country_code] = resolved.iso if resolved
end
# Resolves the subdivision code from whichever handle the caller supplied:
@@ -339,12 +343,12 @@ module Spree
# alone — countries without subdivisions keep it as free text, and
# +state_validate+ decides whether that is acceptable.
def normalize_state
- return if country_iso.blank?
+ return if country_code.blank?
submitted_abbr = self[:state_code].presence
if submitted_abbr.present?
- resolved = Spree::IsoData.subdivision_code(country_iso, submitted_abbr)
+ resolved = Spree::IsoData.subdivision_code(country_code, submitted_abbr)
# A code that means nothing in this country is stale — it came from the
# country the address just moved off — so drop it and let the other
@@ -355,7 +359,7 @@ module Spree
return if state_name.blank?
- matched = Spree::IsoData.subdivision_code(country_iso, state_name)
+ matched = Spree::IsoData.subdivision_code(country_code, state_name)
return if matched.blank?
self[:state_code] = matched
@@ -413,15 +417,15 @@ module Spree
end
def postal_code_validate
- return if country.blank? || country_iso.blank? || !require_zipcode? || zipcode.blank?
- return unless ::ValidatesZipcode::CldrRegexpCollection::ZIPCODES_REGEX.keys.include?(country_iso.upcase.to_sym)
+ return if country.blank? || country_code.blank? || !require_zipcode? || zipcode.blank?
+ return unless ::ValidatesZipcode::CldrRegexpCollection::ZIPCODES_REGEX.keys.include?(country_code.upcase.to_sym)
formatted_zip = ::ValidatesZipcode::Formatter.new(
zipcode: zipcode.to_s.strip,
- country_alpha2: country_iso.upcase
+ country_alpha2: country_code.upcase
).format
- errors.add(:zipcode, :invalid) unless ::ValidatesZipcode.valid?(formatted_zip, country_iso.upcase)
+ errors.add(:zipcode, :invalid) unless ::ValidatesZipcode.valid?(formatted_zip, country_code.upcase)
end
def assign_new_default_address_to_user
diff --git a/spree/core/app/models/spree/country.rb b/spree/core/app/models/spree/country.rb
index e089d72ad8..08a744b132 100644
--- a/spree/core/app/models/spree/country.rb
+++ b/spree/core/app/models/spree/country.rb
@@ -74,7 +74,7 @@ module Spree
# later one. IsoData holds the per-locale cache this reads from.
def states
Spree::IsoData.subdivisions(iso).map do |abbr, subdivision_name|
- Spree::State.new(abbr: abbr, name: subdivision_name, country_iso: iso)
+ Spree::State.new(abbr: abbr, name: subdivision_name, country_code: iso)
end.freeze
end
diff --git a/spree/core/app/models/spree/delivery_zone_member.rb b/spree/core/app/models/spree/delivery_zone_member.rb
index 4477a24944..cdca1bf91a 100644
--- a/spree/core/app/models/spree/delivery_zone_member.rb
+++ b/spree/core/app/models/spree/delivery_zone_member.rb
@@ -7,8 +7,8 @@ module Spree
# ISO codes of countries with numeric postal formats, where lexicographic
# ranges over normalized codes are meaningful. Prefix members are allowed
# for every country; range members only for these. Extend via
- # `Spree::DeliveryZoneMember.range_capable_country_isos += %w[XY]`.
- class_attribute :range_capable_country_isos, default: %w[
+ # `Spree::DeliveryZoneMember.range_capable_country_codes += %w[XY]`.
+ class_attribute :range_capable_country_codes, default: %w[
AR AT AU BD BE BG BR CH CN CZ DE DK DZ EE EG ES FI FR GR HR HU ID IL IN
IS IT JP KR LK LT LU MA MX MY NO NZ PH PK PL PT RO RS RU SA SE SG SI SK
TH TN TR TW UA US UY VN ZA
@@ -27,7 +27,7 @@ module Spree
before_validation :resolve_geography
validates :member_type, presence: true, inclusion: { in: MEMBER_TYPES }
- validates :country_iso, presence: true, if: -> { member_type.in?(MEMBER_TYPES) }
+ validates :country_code, presence: true, if: -> { member_type.in?(MEMBER_TYPES) }
validates :state_code, presence: true, if: -> { member_type == 'state' }
validate :postal_definition, if: -> { member_type == 'postal_code' }
@@ -54,15 +54,15 @@ module Spree
private
def same_country?(address)
- country_iso.present? && address.country_iso == country_iso
+ country_code.present? && address.country_code == country_code
end
# An unresolvable code is left in place for the geography validation to
# report, rather than nilled into a less telling presence error.
def resolve_geography
- return if state_code.blank? || country_iso.blank?
+ return if state_code.blank? || country_code.blank?
- resolved = Spree::IsoData.subdivision_code(country_iso, state_code)
+ resolved = Spree::IsoData.subdivision_code(country_code, state_code)
self.state_code = resolved if resolved
end
@@ -87,7 +87,7 @@ module Spree
return
end
- unless country_iso.present? && range_capable_country_isos.include?(country_iso)
+ unless country_code.present? && range_capable_country_codes.include?(country_code)
errors.add(:base, Spree.t('errors.messages.delivery_zone_range_not_supported'))
return
end
diff --git a/spree/core/app/models/spree/market.rb b/spree/core/app/models/spree/market.rb
index b0984e0aa1..8491378752 100644
--- a/spree/core/app/models/spree/market.rb
+++ b/spree/core/app/models/spree/market.rb
@@ -22,12 +22,12 @@ module Spree
# validation and then delete every join row.
def countries
market_countries.reject(&:marked_for_destruction?).
- filter_map { |join| Spree::Country.by_iso(join.country_iso) }.sort_by(&:name)
+ filter_map { |join| Spree::Country.by_iso(join.country_code) }.sort_by(&:name)
end
# @param values [Array<Spree::Country>]
def countries=(values)
- self.country_isos = Array(values).map { |country| country.respond_to?(:iso) ? country.iso : country.to_s }
+ self.country_codes = Array(values).map { |country| country.respond_to?(:iso) ? country.iso : country.to_s }
end
has_many :orders, class_name: 'Spree::Order', dependent: :nullify
@@ -91,7 +91,7 @@ module Spree
joins(:market_countries)
.where(store_id: store.id)
- .where(spree_market_countries: { country_iso: iso })
+ .where(spree_market_countries: { country_code: iso })
.take
end
@@ -141,14 +141,14 @@ module Spree
super(normalized)
end
- # Read companion for `country_isos=`. Returns the sorted list of ISO codes
+ # Read companion for `country_codes=`. Returns the sorted list of ISO codes
# currently assigned to the market.
#
# @return [Array<String>]
# Reads through +countries+ rather than the join rows: assigning
- # +country_isos=+ replaces that collection, which would leave a cached
+ # +country_codes=+ replaces that collection, which would leave a cached
# market_countries association reporting the old set.
- def country_isos
+ def country_codes
countries.filter_map(&:iso).sort
end
@@ -161,14 +161,14 @@ module Spree
# The single writer for a market's countries — +countries=+ routes here.
# Unknown codes are dropped; the presence validation covers the case where
# every one of them was bogus.
- def country_isos=(values)
+ def country_codes=(values)
isos = Array(values).compact.map { |value| value.to_s.upcase }.reject(&:blank?).uniq
isos = isos.select { |iso| Spree::Country.by_iso(iso) }
- existing = market_countries.index_by(&:country_iso)
+ existing = market_countries.index_by(&:country_code)
- market_countries.each { |join| join.mark_for_destruction unless isos.include?(join.country_iso) }
- (isos - existing.keys).each { |iso| market_countries.build(country_iso: iso) }
+ market_countries.each { |join| join.mark_for_destruction unless isos.include?(join.country_code) }
+ (isos - existing.keys).each { |iso| market_countries.build(country_code: iso) }
end
# Returns true when the market is safe to delete. A market cannot be deleted
diff --git a/spree/core/app/models/spree/market_country.rb b/spree/core/app/models/spree/market_country.rb
index 17dc74e769..8971d2bf1c 100644
--- a/spree/core/app/models/spree/market_country.rb
+++ b/spree/core/app/models/spree/market_country.rb
@@ -7,8 +7,8 @@ module Spree
has_iso_geography state: false
validates :market, presence: true
- validates :country_iso, presence: true
- validates :country_iso, uniqueness: { scope: spree_base_uniqueness_scope + [:market_id] }
+ validates :country_code, presence: true
+ validates :country_code, uniqueness: { scope: spree_base_uniqueness_scope + [:market_id] }
validate :country_covered_by_shipping_zone
validate :country_unique_per_store
@@ -24,7 +24,7 @@ module Spree
return if market.bootstrap_default
return if Spree::DeliveryMethod.none?
- unless store.countries_with_shipping_coverage.any? { |country| country.iso == country_iso }
+ unless store.countries_with_shipping_coverage.any? { |country| country.iso == country_code }
errors.add(:country, :not_in_shipping_zone)
end
end
@@ -36,7 +36,7 @@ module Spree
return if store.blank?
existing = self.class.joins(:market)
- .where(country_iso: country_iso)
+ .where(country_code: country_code)
.where(spree_markets: { store_id: store.id, deleted_at: nil })
.where.not(id: id)
diff --git a/spree/core/app/models/spree/pickup_point_option.rb b/spree/core/app/models/spree/pickup_point_option.rb
index f890960dd8..33f14f574d 100644
--- a/spree/core/app/models/spree/pickup_point_option.rb
+++ b/spree/core/app/models/spree/pickup_point_option.rb
@@ -12,7 +12,7 @@ module Spree
attribute :address2, :string
attribute :city, :string
attribute :zipcode, :string
- attribute :country_iso, :string
+ attribute :country_code, :string
attribute :latitude, :float
attribute :longitude, :float
attribute :provider, :string
diff --git a/spree/core/app/models/spree/promotion/rules/country.rb b/spree/core/app/models/spree/promotion/rules/country.rb
index 062e939888..b784d0b5d0 100644
--- a/spree/core/app/models/spree/promotion/rules/country.rb
+++ b/spree/core/app/models/spree/promotion/rules/country.rb
@@ -1,32 +1,35 @@
# A rule to limit a promotion based on shipment country. Stores an
# array of ISO codes — countries are inherently identified by ISO
-# in the API. The legacy single `country_id` / `country_iso`
+# in the API. The legacy single `country_id` / `country_code`
# preferences still work; they fold into the multi-country list.
+#
+# Rules saved before the `country_iso` → `country_code` rename keep their
+# old preference keys in the serialized hash, so reads fall back to them.
module Spree
class Promotion
module Rules
class Country < Spree::PromotionRule
- preference :country_isos, :array, default: [], parse_on_set: lambda { |values|
+ preference :country_codes, :array, default: [], parse_on_set: lambda { |values|
normalize_id_preference.call(values).map(&:upcase)
}
preference :country_id, :integer # legacy single-country shortcut
- preference :country_iso, :string # legacy ISO-based shortcut
+ preference :country_code, :string # legacy ISO-based shortcut
def applicable?(promotable)
promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)
end
def countries
- isos = preferred_country_isos.presence || [preferred_country_iso].compact_blank
- isos = [legacy_country_iso(preferred_country_id)].compact_blank if isos.blank? && preferred_country_id.present?
+ isos = configured_country_codes.presence || [configured_country_code].compact_blank
+ isos = [legacy_country_code(preferred_country_id)].compact_blank if isos.blank? && preferred_country_id.present?
return [] if isos.blank?
isos.filter_map { |iso| Spree::Country.by_iso(iso) }
end
def eligible?(order, options = {})
- allowed_isos = eligible_country_isos(order)
- shipping_iso = options[:country_iso] || order.ship_address&.country_iso
+ allowed_isos = eligible_country_codes(order)
+ shipping_iso = options[:country_code] || order.ship_address&.country_code
return true if allowed_isos.include?(shipping_iso)
@@ -39,18 +42,28 @@ module Spree
# Order-of-precedence: explicit ISO list > legacy single ISO
# > legacy single ID > store default. Memoized per-instance —
# eligibility checks fire repeatedly per cart change.
- def eligible_country_isos(order = nil)
- @eligible_country_isos ||= compute_eligible_country_isos(order)
+ def eligible_country_codes(order = nil)
+ @eligible_country_codes ||= compute_eligible_country_codes(order)
end
private
- def compute_eligible_country_isos(order)
- return preferred_country_isos.map { |v| v.to_s.upcase } if preferred_country_isos.present?
- return [preferred_country_iso.to_s.upcase] if preferred_country_iso.present?
+ # The stored hash still holds `country_isos` on rules saved before the
+ # rename, and nothing rewrites it — so read both keys.
+ def configured_country_codes
+ preferred_country_codes.presence || Array(preferences[:country_isos])
+ end
+
+ def configured_country_code
+ preferred_country_code.presence || preferences[:country_iso].presence
+ end
+
+ def compute_eligible_country_codes(order)
+ return configured_country_codes.map { |v| v.to_s.upcase } if configured_country_codes.present?
+ return [configured_country_code.to_s.upcase] if configured_country_code.present?
if preferred_country_id.present?
- iso = legacy_country_iso(preferred_country_id)
+ iso = legacy_country_code(preferred_country_id)
return [iso.upcase] if iso.present?
end
@@ -62,7 +75,7 @@ module Spree
# Countries stopped being records in 6.0, so a rule still configured
# with the legacy row id is resolved by reading the table the upgrade
# keeps until 6.1. Rules saved since store the ISO code directly.
- def legacy_country_iso(country_id)
+ def legacy_country_code(country_id)
connection = ActiveRecord::Base.connection
return nil unless connection.table_exists?('spree_countries')
diff --git a/spree/core/app/models/spree/state.rb b/spree/core/app/models/spree/state.rb
index 4251b6a9b4..4722ac55b0 100644
--- a/spree/core/app/models/spree/state.rb
+++ b/spree/core/app/models/spree/state.rb
@@ -5,42 +5,42 @@ module Spree
#
# Like {Spree::Country} this is reference data supplied by the +countries+
# gem rather than a record. A code is only meaningful together with its
- # country, so every state carries +country_iso+.
+ # country, so every state carries +country_code+.
class State
include ActiveModel::Model
include ActiveModel::Attributes
attribute :abbr, :string # the ISO 3166-2 code without the country prefix
attribute :name, :string
- attribute :country_iso, :string
+ attribute :country_code, :string
class << self
- # @param country_iso [String]
+ # @param country_code [String]
# @return [Array<Spree::State>] that country's subdivisions, by name
- def for_country(country_iso)
- Spree::IsoData.subdivisions(country_iso).map do |abbr, name|
- new(abbr: abbr, name: name, country_iso: country_iso)
+ def for_country(country_code)
+ Spree::IsoData.subdivisions(country_code).map do |abbr, name|
+ new(abbr: abbr, name: name, country_code: country_code)
end
end
# Resolves a subdivision from a code or a name, including codes ISO has
# since retired.
#
- # @param country_iso [String]
+ # @param country_code [String]
# @param value [String] code or name
# @return [Spree::State, nil]
- def resolve(country_iso, value)
- code = Spree::IsoData.subdivision_code(country_iso, value)
+ def resolve(country_code, value)
+ code = Spree::IsoData.subdivision_code(country_code, value)
return nil if code.blank?
- new(abbr: code, name: Spree::IsoData.subdivision_name(country_iso, code), country_iso: country_iso)
+ new(abbr: code, name: Spree::IsoData.subdivision_name(country_code, code), country_code: country_code)
end
- # @param country_iso [String]
+ # @param country_code [String]
# @param name_or_abbr [String]
# @return [Array<Spree::State>] the match, or empty when there is none
- def find_all_by_name_or_abbr(country_iso, name_or_abbr)
- Array(resolve(country_iso, name_or_abbr))
+ def find_all_by_name_or_abbr(country_code, name_or_abbr)
+ Array(resolve(country_code, name_or_abbr))
end
end
@@ -48,18 +48,18 @@ module Spree
# @return [Spree::Country, nil]
def country
- @country ||= Spree::Country.by_iso(country_iso)
+ @country ||= Spree::Country.by_iso(country_code)
end
# States are equal when they name the same subdivision of the same
# country — an abbreviation alone is not unique.
def ==(other)
- other.is_a?(Spree::State) && other.abbr == abbr && other.country_iso == country_iso
+ other.is_a?(Spree::State) && other.abbr == abbr && other.country_code == country_code
end
alias eql? ==
def hash
- [country_iso, abbr].hash
+ [country_code, abbr].hash
end
def <=>(other)
diff --git a/spree/core/app/models/spree/stock_location.rb b/spree/core/app/models/spree/stock_location.rb
index a0ae5111f3..65a10061f1 100644
--- a/spree/core/app/models/spree/stock_location.rb
+++ b/spree/core/app/models/spree/stock_location.rb
@@ -38,7 +38,7 @@ module Spree
self.whitelisted_ransackable_attributes = %w[
name active default kind pickup_enabled
- country_iso state_code created_at updated_at
+ country_code state_code created_at updated_at
]
scope :active, -> { where(active: true) }
@@ -163,7 +163,7 @@ module Spree
city: city,
state_code: state_code,
state_name: state_name,
- country_iso: country_iso,
+ country_code: country_code,
zipcode: zipcode,
phone: phone
)
diff --git a/spree/core/app/models/spree/store.rb b/spree/core/app/models/spree/store.rb
index 6d77c77f77..cddab38b10 100644
--- a/spree/core/app/models/spree/store.rb
+++ b/spree/core/app/models/spree/store.rb
@@ -182,7 +182,7 @@ module Spree
# code. Reading goes through Spree::Stores::Markets#default_country, which
# prefers the default market's country when the store has markets.
def default_country=(value)
- self[:default_country_iso_code] = value&.iso
+ self[:default_country_code] = value&.iso
end
has_many :reports, class_name: 'Spree::Report'
@@ -300,21 +300,25 @@ module Spree
channels.default.first || channels.active.first
end
- # Virtual attribute — sets the country for the default market created on store creation.
- # Not persisted on the store itself; only used by the after_create callback.
- attr_reader :default_country_iso
+ # Sets the stored code and seeds the country for the default market created
+ # on store creation. Reading goes through Spree::Stores::Markets, which
+ # prefers the default market's country once the store has markets.
+ def default_country_code=(code)
+ return if code.blank?
- def default_country_iso=(iso)
- return if iso.blank?
-
- @default_country_iso = iso
- country = Spree::Country.by_iso(iso)
+ country = Spree::Country.by_iso(code)
return if country.nil?
- self[:default_country_iso_code] = country.iso
+ self[:default_country_code] = country.iso
@default_country_for_market = country
end
+ # @deprecated Use +default_country_code=+. Removed in 6.1.
+ def default_country_iso=(code)
+ Spree::Deprecation.warn('Spree::Store#default_country_iso= is deprecated, use #default_country_code= instead')
+ self.default_country_code = code
+ end
+
def unique_name
@unique_name ||= "#{name} (#{code})"
end
@@ -397,10 +401,10 @@ module Spree
# Every member carries its own country, including state members, so
# coverage no longer has to resolve a subdivision back to its country.
- country_isos = Spree::DeliveryZoneMember.where(delivery_zone_id: zone_ids).
- where.not(country_iso: nil).distinct.pluck(:country_iso)
+ country_codes = Spree::DeliveryZoneMember.where(delivery_zone_id: zone_ids).
+ where.not(country_code: nil).distinct.pluck(:country_code)
- country_isos.filter_map { |iso| Spree::Country.by_iso(iso) }.sort_by(&:name)
+ country_codes.filter_map { |code| Spree::Country.by_iso(code) }.sort_by(&:name)
end
# Returns the default stock location for the store or creates a new one if it doesn't exist
@@ -410,7 +414,7 @@ module Spree
stock_location_scope = Spree::StockLocation.where(default: true)
stock_location_scope.first || ActiveRecord::Base.connected_to(role: :writing) do
stock_location_scope.create(default: true, name: Spree.t(:default_stock_location_name),
- country_iso: default_country&.iso)
+ country_code: default_country&.iso)
end
end
end
diff --git a/spree/core/app/models/spree/tax_exemption.rb b/spree/core/app/models/spree/tax_exemption.rb
index 4f3666862e..ec800722e0 100644
--- a/spree/core/app/models/spree/tax_exemption.rb
+++ b/spree/core/app/models/spree/tax_exemption.rb
@@ -18,7 +18,7 @@ module Spree
# Where the claim holds. Nil country = everywhere the provider taxes,
# nil state = the whole country.
- attribute :country_iso, :string
+ attribute :country_code, :string
attribute :state_code, :string
# Per-line departures from the entry. Empty = the whole order is claimed.
@@ -42,12 +42,12 @@ module Spree
# no country claims every jurisdiction; one with a country but no state
# claims every state within it.
#
- # @param country_iso [String, nil]
+ # @param country_code [String, nil]
# @param state_code [String, nil]
# @return [Boolean]
- def covers_jurisdiction?(country_iso, state_code = nil)
- return true if self.country_iso.blank?
- return false unless self.country_iso.casecmp?(country_iso.to_s)
+ def covers_jurisdiction?(country_code, state_code = nil)
+ return true if self.country_code.blank?
+ return false unless self.country_code.casecmp?(country_code.to_s)
return true if self.state_code.blank?
self.state_code.casecmp?(state_code.to_s)
diff --git a/spree/core/app/models/spree/tax_exemption_certificate.rb b/spree/core/app/models/spree/tax_exemption_certificate.rb
index 9b32e81a4a..cc8e99a206 100644
--- a/spree/core/app/models/spree/tax_exemption_certificate.rb
+++ b/spree/core/app/models/spree/tax_exemption_certificate.rb
@@ -35,7 +35,7 @@ module Spree
validates :document, size: { less_than_or_equal_to: MAX_DOCUMENT_SIZE }
- # Where the certificate holds, as codes: a blank country_iso claims every
+ # Where the certificate holds, as codes: a blank country_code claims every
# country, and a country with no state_code claims all of its states.
# New writes reject unknown codes; a stored one that stops resolving still
# narrows the certificate to nothing, never widens it to everywhere.
@@ -52,7 +52,7 @@ module Spree
scope :for_address, lambda { |address|
next none if address.nil?
- where(country_iso: [address.country_iso.presence, nil].uniq).
+ where(country_code: [address.country_code.presence, nil].uniq).
where(state_code: [address.state_code.presence, nil].uniq)
}
diff --git a/spree/core/app/models/spree/tax_line.rb b/spree/core/app/models/spree/tax_line.rb
index 63ed8027df..91c46095f5 100644
--- a/spree/core/app/models/spree/tax_line.rb
+++ b/spree/core/app/models/spree/tax_line.rb
@@ -49,7 +49,7 @@ module Spree
# Tax reporting is the reason the treatment columns exist — "which country's
# tax was this, and which sales were reverse-charged" has to be answerable.
- self.whitelisted_ransackable_attributes = %w[taxability_reason country_iso state_code included provider_id]
+ self.whitelisted_ransackable_attributes = %w[taxability_reason country_code state_code included provider_id]
scope :included_in_price, -> { where(included: true) }
scope :additional, -> { where(included: false) }
diff --git a/spree/core/app/models/spree/tax_provider/internal.rb b/spree/core/app/models/spree/tax_provider/internal.rb
index e32fdfc8b5..316e318ed4 100644
--- a/spree/core/app/models/spree/tax_provider/internal.rb
+++ b/spree/core/app/models/spree/tax_provider/internal.rb
@@ -127,7 +127,7 @@ module Spree
# still say where the sale was taxed.
def jurisdiction_for(rate, owner)
{
- country_iso: rate.country_iso.presence || owner.tax_country&.iso,
+ country_code: rate.country_code.presence || owner.tax_country&.iso,
state_code: rate.state_code.presence || owner.tax_address&.state_code
}
end
@@ -138,7 +138,7 @@ module Spree
def exemption_for(item, exemptions, jurisdiction)
Array(exemptions).find do |exemption|
exemption.covers_item?(item) &&
- exemption.covers_jurisdiction?(jurisdiction[:country_iso], jurisdiction[:state_code])
+ exemption.covers_jurisdiction?(jurisdiction[:country_code], jurisdiction[:state_code])
end
end
diff --git a/spree/core/app/models/spree/tax_rate.rb b/spree/core/app/models/spree/tax_rate.rb
index 9257261164..77de58657e 100644
--- a/spree/core/app/models/spree/tax_rate.rb
+++ b/spree/core/app/models/spree/tax_rate.rb
@@ -28,7 +28,7 @@ module Spree
validates :tax_category, :name
end
- # The jurisdiction this rate applies in, held as codes: a blank country_iso
+ # The jurisdiction this rate applies in, held as codes: a blank country_code
# means everywhere, and a country with no state_code means the whole
# country. Upcased on the way in so a rate entered as "de" still matches an
# address from Germany.
@@ -42,20 +42,20 @@ module Spree
# Spree::Purchase::Taxation#tax_country).
# +normalizes+ above applies to query values too, so a caller passing "de"
# still matches a rate stored as "DE".
- scope :for_jurisdiction, lambda { |country_iso, state_code = nil|
- where(country_iso: [country_iso.presence, nil].uniq).where(state_code: [state_code.presence, nil].uniq)
+ scope :for_jurisdiction, lambda { |country_code, state_code = nil|
+ where(country_code: [country_code.presence, nil].uniq).where(state_code: [state_code.presence, nil].uniq)
}
# The same question asked with an address in hand.
- scope :for_address, ->(address) { for_jurisdiction(address&.country_iso, address&.state_code) }
- # Country-wide: unlike for_jurisdiction(country_iso, nil) this leaves the
+ scope :for_address, ->(address) { for_jurisdiction(address&.country_code, address&.state_code) }
+ # Country-wide: unlike for_jurisdiction(country_code, nil) this leaves the
# state unconstrained, so it sums a country's state-level rates too. Used
# where the state is irrelevant — backing VAT out of a gross price.
- scope :for_country, ->(country_iso) { where(country_iso: [country_iso.presence, nil].uniq) }
+ scope :for_country, ->(country_code) { where(country_code: [country_code.presence, nil].uniq) }
scope :for_tax_category,
->(category) { where(tax_category_id: category.try(:id)) }
scope :included_in_price, -> { where(included_in_price: true) }
- self.whitelisted_ransackable_attributes = %w[amount country_iso state_code tax_category_id included_in_price name]
+ self.whitelisted_ransackable_attributes = %w[amount country_code state_code tax_category_id included_in_price name]
# Virtual attribute for percentage display in admin forms
def amount_percentage
@@ -76,10 +76,10 @@ module Spree
# +:country+ is a documented override point and the VAT path still hands
# it a Spree::Country, so take the code off whichever arrives.
country = options[:country]
- country_iso = country.try(:iso) || country.presence || options[:address]&.country_iso
- return 0 unless country_iso && options[:tax_category]
+ country_code = country.try(:iso) || country.presence || options[:address]&.country_code
+ return 0 unless country_code && options[:tax_category]
- scope = options[:address] ? for_address(options[:address]) : for_country(country_iso)
+ scope = options[:address] ? for_address(options[:address]) : for_country(country_code)
# Per-store tax configuration is the norm since 6.0, so without this the
# sum would add up every store's rate for the same country.
store = options[:store] || Spree::Current.store
diff --git a/spree/core/app/services/spree/addresses/update.rb b/spree/core/app/services/spree/addresses/update.rb
index c6f850984b..ede68abb9e 100644
--- a/spree/core/app/services/spree/addresses/update.rb
+++ b/spree/core/app/services/spree/addresses/update.rb
@@ -84,7 +84,7 @@ module Spree
# the edit forms post a partial set of fields.
def prepare_address_params!(address, address_params)
address_params[:customer_id] = address&.customer_id
- address_params[:country_iso] ||= address.country_iso
+ address_params[:country_code] ||= address.country_code
address_params.transform_values!(&:presence)
end
diff --git a/spree/core/app/services/spree/carts/update.rb b/spree/core/app/services/spree/carts/update.rb
index bc0275bcb7..df1feb20c5 100644
--- a/spree/core/app/services/spree/carts/update.rb
+++ b/spree/core/app/services/spree/carts/update.rb
@@ -147,9 +147,9 @@ module Spree
# is not part of the new market. The market dictates which countries
# are available for checkout.
def clear_shipping_address_if_outside_market
- return unless cart.market_id_changed? && cart.ship_address&.country_iso.present?
+ return unless cart.market_id_changed? && cart.ship_address&.country_code.present?
- unless cart.market.country_isos.include?(cart.ship_address.country_iso)
+ unless cart.market.country_codes.include?(cart.ship_address.country_code)
cart.ship_address = nil
@address_invalidated = true
end
diff --git a/spree/core/app/services/spree/imports/row_processors/customer.rb b/spree/core/app/services/spree/imports/row_processors/customer.rb
index 3d72592339..0323fcdb2f 100644
--- a/spree/core/app/services/spree/imports/row_processors/customer.rb
+++ b/spree/core/app/services/spree/imports/row_processors/customer.rb
@@ -48,10 +48,10 @@ module Spree
address.phone = attributes['phone'].presence || user.phone
if attributes['country_code'].present?
- address.country_iso = attributes['country_code'].strip
+ address.country_code = attributes['country_code'].strip
end
- if attributes['province_code'].present? && address.country_iso.present?
+ if attributes['province_code'].present? && address.country_code.present?
address.state_code = attributes['province_code'].strip
end
diff --git a/spree/core/app/services/spree/seeds/delivery_zones.rb b/spree/core/app/services/spree/seeds/delivery_zones.rb
index b34ee0f7ad..c0da179ad4 100644
--- a/spree/core/app/services/spree/seeds/delivery_zones.rb
+++ b/spree/core/app/services/spree/seeds/delivery_zones.rb
@@ -20,7 +20,7 @@ module Spree
zone.description = domestic_country.name
zone.delivery_profile = profile
end
- domestic.members.where(member_type: 'country', country_iso: domestic_country.iso).first_or_create!
+ domestic.members.where(member_type: 'country', country_code: domestic_country.iso).first_or_create!
international = store.delivery_zones.where(name: 'International').first_or_create! do |zone|
zone.description = 'Everywhere else'
@@ -36,7 +36,7 @@ module Spree
private
def add_country_members(zone, countries)
- existing_isos = zone.members.where(member_type: 'country').pluck(:country_iso)
+ existing_isos = zone.members.where(member_type: 'country').pluck(:country_code)
new_isos = countries.map(&:iso) - existing_isos
return if new_isos.empty?
@@ -45,7 +45,7 @@ module Spree
{
delivery_zone_id: zone.id,
member_type: 'country',
- country_iso: iso,
+ country_code: iso,
created_at: now,
updated_at: now
}
diff --git a/spree/core/app/services/spree/seeds/stock_locations.rb b/spree/core/app/services/spree/seeds/stock_locations.rb
index 3e3d150738..0f6ad3ff8a 100644
--- a/spree/core/app/services/spree/seeds/stock_locations.rb
+++ b/spree/core/app/services/spree/seeds/stock_locations.rb
@@ -14,7 +14,7 @@ module Spree
name: Spree.t(:default_stock_location_name)
).first_or_create! do |stock_location|
stock_location.propagate_all_variants = false
- stock_location.country_iso = store.default_country&.iso
+ stock_location.country_code = store.default_country&.iso
stock_location.active = true
stock_location.default = true
end
diff --git a/spree/core/app/services/spree/seeds/stores.rb b/spree/core/app/services/spree/seeds/stores.rb
index 5f98299f54..e59e4ae760 100644
--- a/spree/core/app/services/spree/seeds/stores.rb
+++ b/spree/core/app/services/spree/seeds/stores.rb
@@ -13,7 +13,7 @@ module Spree
s.mail_from_address = '[email protected]'
s.customer_support_email = '[email protected]'
s.default_currency = 'USD'
- s.default_country_iso = 'US'
+ s.default_country_code = 'US'
s.default_locale = I18n.locale
end.save!
end
diff --git a/spree/core/app/services/spree/tax/resolve_exemptions.rb b/spree/core/app/services/spree/tax/resolve_exemptions.rb
index 391bf94cc2..1b91603348 100644
--- a/spree/core/app/services/spree/tax/resolve_exemptions.rb
+++ b/spree/core/app/services/spree/tax/resolve_exemptions.rb
@@ -31,7 +31,7 @@ module Spree
Spree::TaxExemption.new(
reason_code: certificate.reason_code,
certificate_number: certificate.certificate_number,
- country_iso: certificate.country_iso,
+ country_code: certificate.country_code,
state_code: certificate.state_code
)
end
diff --git a/spree/core/app/validators/spree/addresses/phone_validator.rb b/spree/core/app/validators/spree/addresses/phone_validator.rb
index 328e316264..50f4697d15 100644
--- a/spree/core/app/validators/spree/addresses/phone_validator.rb
+++ b/spree/core/app/validators/spree/addresses/phone_validator.rb
@@ -8,10 +8,10 @@ module Spree
module Addresses
class PhoneValidator < ActiveModel::Validator
def validate(address)
- return if !address.require_phone? || address.phone.blank? || address.country.blank? || address.country_iso.blank?
+ return if !address.require_phone? || address.phone.blank? || address.country.blank? || address.country_code.blank?
phone = Phonelib.parse(address.phone)
- unless phone.valid_for_country?(address.country_iso)
+ unless phone.valid_for_country?(address.country_code)
address.errors.add(:phone, :invalid)
end
end
diff --git a/spree/core/db/migrate/20260806000002_add_treatment_columns_to_spree_tax_lines.rb b/spree/core/db/migrate/20260806000002_add_treatment_columns_to_spree_tax_lines.rb
index 40b0b3b46b..daf5db3130 100644
--- a/spree/core/db/migrate/20260806000002_add_treatment_columns_to_spree_tax_lines.rb
+++ b/spree/core/db/migrate/20260806000002_add_treatment_columns_to_spree_tax_lines.rb
@@ -10,10 +10,10 @@ class AddTreatmentColumnsToSpreeTaxLines < ActiveRecord::Migration[8.1]
# address: origin-taxed sales (below-threshold digital supplies, US states
# that source to the seller) tax somewhere else entirely, and the EU
# one-stop-shop return is filed per destination country.
- add_column :spree_tax_lines, :country_iso, :string
+ add_column :spree_tax_lines, :country_code, :string
add_column :spree_tax_lines, :state_code, :string
add_index :spree_tax_lines, :taxability_reason
- add_index :spree_tax_lines, [:country_iso, :state_code]
+ add_index :spree_tax_lines, [:country_code, :state_code]
end
end
diff --git a/spree/core/db/migrate/20260806000005_add_country_and_state_to_spree_tax_rates.rb b/spree/core/db/migrate/20260806000005_add_country_and_state_to_spree_tax_rates.rb
index cd96144032..a57b22b31a 100644
--- a/spree/core/db/migrate/20260806000005_add_country_and_state_to_spree_tax_rates.rb
+++ b/spree/core/db/migrate/20260806000005_add_country_and_state_to_spree_tax_rates.rb
@@ -12,9 +12,9 @@ class AddCountryAndStateToSpreeTaxRates < ActiveRecord::Migration[8.1]
# it — one zone can span several. Existing rows are converted by
# `spree:migrate_tax_zones`, which splits a multi-country zone into one rate
# per country, before `zone_id` comes off.
- add_column :spree_tax_rates, :country_iso, :string
+ add_column :spree_tax_rates, :country_code, :string
add_column :spree_tax_rates, :state_code, :string
- add_index :spree_tax_rates, [:country_iso, :state_code]
+ add_index :spree_tax_rates, [:country_code, :state_code]
end
end
diff --git a/spree/core/db/migrate/20260807000003_create_spree_tax_exemption_certificates.rb b/spree/core/db/migrate/20260807000003_create_spree_tax_exemption_certificates.rb
index cdc4562d7c..7d51acb718 100644
--- a/spree/core/db/migrate/20260807000003_create_spree_tax_exemption_certificates.rb
+++ b/spree/core/db/migrate/20260807000003_create_spree_tax_exemption_certificates.rb
@@ -4,7 +4,7 @@ class CreateSpreeTaxExemptionCertificates < ActiveRecord::Migration[8.1]
t.references :company, null: false
# Codes, not references: Country and State are being dropped, and a blank
# code is what "everywhere" means here. Same shape as spree_tax_rates.
- t.string :country_iso # nil = every country
+ t.string :country_code # nil = every country
t.string :state_code # nil = the entire country
t.string :certificate_number, null: false
t.string :reason_code, null: false # resale, government, … — becomes the
@@ -26,6 +26,6 @@ class CreateSpreeTaxExemptionCertificates < ActiveRecord::Migration[8.1]
end
add_index :spree_tax_exemption_certificates, [:company_id, :status]
- add_index :spree_tax_exemption_certificates, [:country_iso, :state_code]
+ add_index :spree_tax_exemption_certificates, [:country_code, :state_code]
end
end
diff --git a/spree/core/db/migrate/20260807130001_add_iso_codes_to_country_state_consumers.rb b/spree/core/db/migrate/20260807130001_add_country_state_codes_to_consumers.rb
similarity index 53%
rename from spree/core/db/migrate/20260807130001_add_iso_codes_to_country_state_consumers.rb
rename to spree/core/db/migrate/20260807130001_add_country_state_codes_to_consumers.rb
index 722a9d47bb..29538a413e 100644
--- a/spree/core/db/migrate/20260807130001_add_iso_codes_to_country_state_consumers.rb
+++ b/spree/core/db/migrate/20260807130001_add_country_state_codes_to_consumers.rb
@@ -1,29 +1,28 @@
-class AddIsoCodesToCountryStateConsumers < ActiveRecord::Migration[7.2]
+class AddCountryStateCodesToConsumers < ActiveRecord::Migration[7.2]
def change
- add_column :spree_addresses, :country_iso, :string
+ add_column :spree_addresses, :country_code, :string
add_column :spree_addresses, :state_code, :string
- add_index :spree_addresses, :country_iso
+ add_index :spree_addresses, :country_code
# State members carry their country too: a subdivision code is only unique
# within its country ("CA" is California and several other things), and
# coverage queries would otherwise need the states table to resolve it.
- add_column :spree_delivery_zone_members, :country_iso, :string
+ add_column :spree_delivery_zone_members, :country_code, :string
add_column :spree_delivery_zone_members, :state_code, :string
- add_index :spree_delivery_zone_members, :country_iso
+ add_index :spree_delivery_zone_members, :country_code
- add_column :spree_market_countries, :country_iso, :string
- add_index :spree_market_countries, [:market_id, :country_iso],
- unique: true, name: 'index_spree_market_countries_on_market_id_and_country_iso'
+ add_column :spree_market_countries, :country_code, :string
+ add_index :spree_market_countries, [:market_id, :country_code],
+ unique: true, name: 'index_spree_market_countries_on_market_id_and_country_code'
# The country foreign key stays until 6.1 so the upgrade task keeps its
# source data, but nothing writes it any more — a market country is
# identified by its ISO code now.
change_column_null :spree_market_countries, :country_id, true
- add_column :spree_stock_locations, :country_iso, :string
+ add_column :spree_stock_locations, :country_code, :string
add_column :spree_stock_locations, :state_code, :string
- # Not `default_country_iso`, which is already a virtual attribute on Store.
- add_column :spree_stores, :default_country_iso_code, :string
+ add_column :spree_stores, :default_country_code, :string
end
end
diff --git a/spree/core/db/sample_data/fulfillment.rb b/spree/core/db/sample_data/fulfillment.rb
index c5326878a8..2b0c719a02 100644
--- a/spree/core/db/sample_data/fulfillment.rb
+++ b/spree/core/db/sample_data/fulfillment.rb
@@ -14,7 +14,7 @@ stock_location = store.stock_locations.find_by(default: true) || store.stock_loc
# Any missing field leaves the origin unquotable, so completeness — not just a
# blank street — decides whether the demo address applies.
-if stock_location&.country_iso == 'US' &&
+if stock_location&.country_code == 'US' &&
[stock_location.address1, stock_location.city, stock_location.state_code, stock_location.zipcode].any?(&:blank?)
stock_location.update!(
address1: '417 Montgomery St',
diff --git a/spree/core/db/sample_data/markets.rb b/spree/core/db/sample_data/markets.rb
index 24d5711924..eb0554b852 100644
--- a/spree/core/db/sample_data/markets.rb
+++ b/spree/core/db/sample_data/markets.rb
@@ -49,7 +49,7 @@ end
assigned_scope = Spree::MarketCountry.joins(:market).
where(spree_markets: { store_id: store.id, deleted_at: nil })
assigned_scope = assigned_scope.where.not(market_id: market.id) if market.persisted?
- assigned_isos = assigned_scope.pluck(:country_iso).to_set
+ assigned_isos = assigned_scope.pluck(:country_code).to_set
countries = attrs[:isos].filter_map { |iso| Spree::Country.by_iso(iso) }.
reject { |country| assigned_isos.include?(country.iso) }
diff --git a/spree/core/db/sample_data/orders.rb b/spree/core/db/sample_data/orders.rb
index d3bd48c235..4212b35f7b 100644
--- a/spree/core/db/sample_data/orders.rb
+++ b/spree/core/db/sample_data/orders.rb
@@ -20,7 +20,7 @@ billing_address = Spree::Address.find_or_create_by!(
city: 'Bethesda',
state_abbr: ny_abbr,
zipcode: '20814',
- country_iso: us_iso,
+ country_code: us_iso,
phone: '555-0199'
)
@@ -31,7 +31,7 @@ shipping_address = Spree::Address.find_or_create_by!(
city: 'Washington',
state_abbr: ny_abbr,
zipcode: '20500',
- country_iso: us_iso,
+ country_code: us_iso,
phone: '555-0199'
)
diff --git a/spree/core/lib/spree/core/pricing/context.rb b/spree/core/lib/spree/core/pricing/context.rb
index 1b043ffbdf..2e36ba4909 100644
--- a/spree/core/lib/spree/core/pricing/context.rb
+++ b/spree/core/lib/spree/core/pricing/context.rb
@@ -31,7 +31,7 @@ module Spree
# country row, so eligibility keeps working once Spree::Country is gone.
#
# @return [String, nil]
- def country_iso
+ def country_code
country&.iso
end
diff --git a/spree/core/lib/spree/permitted_attributes.rb b/spree/core/lib/spree/permitted_attributes.rb
index 0f01fc70b5..b62c93342d 100644
--- a/spree/core/lib/spree/permitted_attributes.rb
+++ b/spree/core/lib/spree/permitted_attributes.rb
@@ -78,7 +78,7 @@ module Spree
@@address_attributes = [
:id, :firstname, :lastname, :first_name, :last_name,
# state_abbr is the deprecated write name (see Spree::Address); 6.1 drops it.
- :address1, :address2, :city, :country_iso, :state_code, :state_abbr,
+ :address1, :address2, :city, :country_code, :state_code, :state_abbr,
:zipcode, :phone, :state_name, :alternative_phone, :company,
:user_id, :deleted_at, :label, :quick_checkout
]
@@ -245,7 +245,7 @@ module Spree
stock_movements_attributes: [:variant_id, :quantity, :originator_id, :stock_item_id]]
@@store_attributes = [:name, :url, :seo_title, :code, :meta_keywords,
- :meta_description, :default_currency, :default_country_iso, :mail_from_address,
+ :meta_description, :default_currency, :default_country_code, :mail_from_address,
:customer_support_email, :description, :address, :contact_phone,
:supported_locales, :default_locale, :supported_currencies,
:new_order_notifications_email,
diff --git a/spree/core/lib/spree/testing_support/factories/address_factory.rb b/spree/core/lib/spree/testing_support/factories/address_factory.rb
index 1d19b4ee49..1a4c7b98f9 100644
--- a/spree/core/lib/spree/testing_support/factories/address_factory.rb
+++ b/spree/core/lib/spree/testing_support/factories/address_factory.rb
@@ -12,7 +12,7 @@ FactoryBot.define do
# A real US/NY pair, so generated OpenAPI examples carry plausible fields
# and address validation has a subdivision it recognises. The model stores
# plain codes; country/state stay as transient value objects so specs can
- # keep passing them (or country_iso/state_code directly).
+ # keep passing them (or country_code/state_code directly).
transient do
country { Spree::Country.by_iso('US') }
@@ -30,7 +30,7 @@ FactoryBot.define do
end
end
- country_iso { country&.iso }
+ country_code { country&.iso }
state_code { state&.abbr }
# Countries now carry their real postal formats, so a US ZIP would be
diff --git a/spree/core/lib/spree/testing_support/factories/delivery_zone_factory.rb b/spree/core/lib/spree/testing_support/factories/delivery_zone_factory.rb
index 766a347f17..8a864e46cf 100644
--- a/spree/core/lib/spree/testing_support/factories/delivery_zone_factory.rb
+++ b/spree/core/lib/spree/testing_support/factories/delivery_zone_factory.rb
@@ -28,7 +28,7 @@ FactoryBot.define do
state { nil }
end
- country_iso { country&.iso || state&.country_iso }
+ country_code { country&.iso || state&.country_code }
state_code { state&.abbr }
end
end
diff --git a/spree/core/lib/spree/testing_support/factories/state_factory.rb b/spree/core/lib/spree/testing_support/factories/state_factory.rb
index ae61fbe61e..03e1920729 100644
--- a/spree/core/lib/spree/testing_support/factories/state_factory.rb
+++ b/spree/core/lib/spree/testing_support/factories/state_factory.rb
@@ -8,16 +8,16 @@ FactoryBot.define do
country { Spree::Country.by_iso('US') }
end
- country_iso { country&.iso }
+ country_code { country&.iso }
abbr do
- codes = country_iso ? Spree::IsoData.subdivisions(country_iso).keys : []
+ codes = country_code ? Spree::IsoData.subdivisions(country_code).keys : []
codes.any? ? codes[subdivision_index % codes.size] : nil
end
- name { (country_iso && abbr && Spree::IsoData.subdivision_name(country_iso, abbr)) || abbr }
+ name { (country_code && abbr && Spree::IsoData.subdivision_name(country_code, abbr)) || abbr }
skip_create
- initialize_with { Spree::State.new(abbr: abbr, name: name, country_iso: country_iso) }
+ initialize_with { Spree::State.new(abbr: abbr, name: name, country_code: country_code) }
end
end
diff --git a/spree/core/lib/spree/testing_support/factories/stock_location_factory.rb b/spree/core/lib/spree/testing_support/factories/stock_location_factory.rb
index dcd579aed8..e4204df962 100644
--- a/spree/core/lib/spree/testing_support/factories/stock_location_factory.rb
+++ b/spree/core/lib/spree/testing_support/factories/stock_location_factory.rb
@@ -17,7 +17,7 @@ FactoryBot.define do
state { country&.states&.first }
end
- country_iso { country&.iso }
+ country_code { country&.iso }
state_code { state&.abbr }
factory :stock_location_with_items do
diff --git a/spree/core/lib/spree/testing_support/factories/tax_rate_factory.rb b/spree/core/lib/spree/testing_support/factories/tax_rate_factory.rb
index 38105209b0..d017772b77 100644
--- a/spree/core/lib/spree/testing_support/factories/tax_rate_factory.rb
+++ b/spree/core/lib/spree/testing_support/factories/tax_rate_factory.rb
@@ -1,13 +1,13 @@
FactoryBot.define do
factory :tax_rate, class: Spree::TaxRate do
name { "TaxRate - #{rand(999_999)}" }
- country_iso { 'US' }
+ country_code { 'US' }
tax_category
amount { 0.1 }
# Taxes every country — what a single-market store configures.
trait :worldwide do
- country_iso { nil }
+ country_code { nil }
end
end
end
diff --git a/spree/core/lib/spree/testing_support/store.rb b/spree/core/lib/spree/testing_support/store.rb
index 8cfe1f4011..9ade30cc51 100644
--- a/spree/core/lib/spree/testing_support/store.rb
+++ b/spree/core/lib/spree/testing_support/store.rb
@@ -21,8 +21,8 @@ RSpec.configure do |config|
# nothing to create — the store just names one.
@default_country = Spree::Country.by_iso('US')
@default_store = Spree::Store.find_by(default: true) || FactoryBot.create(:store, default: true, default_currency: 'USD')
- unless @default_store.read_attribute(:default_country_iso_code) == 'US'
- @default_store.update_column(:default_country_iso_code, 'US')
+ unless @default_store.read_attribute(:default_country_code) == 'US'
+ @default_store.update_column(:default_country_code, 'US')
end
end
end
diff --git a/spree/core/lib/spree/upgrades/5_6_to_6_0/manifest.yml b/spree/core/lib/spree/upgrades/5_6_to_6_0/manifest.yml
index 31dd0d48ea..39774b7d45 100644
--- a/spree/core/lib/spree/upgrades/5_6_to_6_0/manifest.yml
+++ b/spree/core/lib/spree/upgrades/5_6_to_6_0/manifest.yml
@@ -192,9 +192,9 @@ steps:
and spree_states directly — countries and states are reference data in
6.0, so their models can no longer look the rows up.
- - id: migrate_country_state_isos
+ - id: migrate_country_state_codes
name: "Name countries and states by ISO code"
- task: "spree:upgrade:migrate_country_state_isos"
+ task: "spree:upgrade:migrate_country_state_codes"
notes: |
Countries and states stop being database records in Spree 6. Addresses,
delivery zone members, market countries, stock locations and stores name
diff --git a/spree/core/lib/tasks/delivery_migration.rake b/spree/core/lib/tasks/delivery_migration.rake
index c6e80a6df7..9546ac95cc 100644
--- a/spree/core/lib/tasks/delivery_migration.rake
+++ b/spree/core/lib/tasks/delivery_migration.rake
@@ -131,7 +131,7 @@ namespace :spree do
# being records — so the legacy tables are read directly by id, the way
# this task's sibling upgrade steps read tables their models no longer own.
connection = ActiveRecord::Base.connection
- country_iso_for = lambda do |country_id|
+ country_code_for = lambda do |country_id|
return nil if country_id.blank?
connection.select_value(
@@ -155,10 +155,10 @@ namespace :spree do
zone.zone_members.find_each do |member|
case member.zoneable_type
when 'Spree::Country'
- iso = country_iso_for.call(member.zoneable_id)
+ iso = country_code_for.call(member.zoneable_id)
next if iso.blank?
- delivery_zone.members.create!(member_type: 'country', country_iso: iso)
+ delivery_zone.members.create!(member_type: 'country', country_code: iso)
when 'Spree::State'
pair = state_pair_for.call(member.zoneable_id)
next if pair.nil?
@@ -166,7 +166,7 @@ namespace :spree do
abbr, iso = pair
# A state member carries its country too: a subdivision code is only
# unique within its country.
- delivery_zone.members.create!(member_type: 'state', state_code: abbr, country_iso: iso)
+ delivery_zone.members.create!(member_type: 'state', state_code: abbr, country_code: iso)
end
end
end
diff --git a/spree/core/lib/tasks/migrate_country_state_isos.rake b/spree/core/lib/tasks/migrate_country_state_codes.rake
similarity index 87%
rename from spree/core/lib/tasks/migrate_country_state_isos.rake
rename to spree/core/lib/tasks/migrate_country_state_codes.rake
index 9d9734aebe..6d46b4766d 100644
--- a/spree/core/lib/tasks/migrate_country_state_isos.rake
+++ b/spree/core/lib/tasks/migrate_country_state_codes.rake
@@ -3,7 +3,7 @@
# infrastructure. Same placement as Spree::ReturnsMigrator in a sibling task.
module Spree
# Copies country and state foreign keys onto the ISO string columns that
- # replace them. Driven by `rake spree:upgrade:migrate_country_state_isos`.
+ # replace them. Driven by `rake spree:upgrade:migrate_country_state_codes`.
#
# Reads the legacy tables through throwaway model classes: Spree::Country and
# Spree::State stop being ActiveRecord models in 6.0, but this task has to
@@ -13,7 +13,7 @@ module Spree
# scoped to the rows whose ISO column is still null, so the work outstanding
# is a query rather than tracked state. An interrupted run picks up where it
# stopped, and re-running when nothing is left is a no-op.
- class CountryStateIsoMigrator
+ class CountryStateCodeMigrator
COUNTRIES_TABLE = 'spree_countries'.freeze
STATES_TABLE = 'spree_states'.freeze
@@ -42,7 +42,7 @@ module Spree
# Country ISO for every row whose FK still resolves. The state branch is
# separate because a row can carry a country without a state.
- def backfill_country_iso(table, foreign_key: 'country_id', column: 'country_iso')
+ def backfill_country_code(table, foreign_key: 'country_id', column: 'country_code')
return 0 unless connection.column_exists?(table, column)
update_from(
@@ -55,37 +55,37 @@ module Spree
end
def backfill_addresses
- filled = backfill_country_iso(Spree::Address.table_name)
+ filled = backfill_country_code(Spree::Address.table_name)
filled + backfill_state_code(Spree::Address.table_name)
end
def backfill_delivery_zone_members
table = Spree::DeliveryZoneMember.table_name
- filled = backfill_country_iso(table)
+ filled = backfill_country_code(table)
filled += copy_state_code(table)
# A state member records no country of its own, so its country comes from
# the state's — without it, coverage queries could not tell which country
# an abbreviation belongs to. Runs before normalization, which needs both
# halves to resolve a code.
- filled += backfill_country_iso_from_state(table)
+ filled += backfill_country_code_from_state(table)
normalize_state_codes(table)
filled
end
def backfill_market_countries
- backfill_country_iso(Spree::MarketCountry.table_name)
+ backfill_country_code(Spree::MarketCountry.table_name)
end
def backfill_stock_locations
table = Spree::StockLocation.table_name
- backfill_country_iso(table) + backfill_state_code(table)
+ backfill_country_code(table) + backfill_state_code(table)
end
def backfill_stores
- backfill_country_iso(
+ backfill_country_code(
Spree::Store.table_name,
foreign_key: 'default_country_id',
- column: 'default_country_iso_code'
+ column: 'default_country_code'
)
end
@@ -120,37 +120,37 @@ module Spree
def normalize_state_codes(table)
quoted_table = quote(table)
rows = connection.select_rows(<<~SQL.squish)
- SELECT DISTINCT country_iso, state_code FROM #{quoted_table}
- WHERE state_code IS NOT NULL AND country_iso IS NOT NULL
+ SELECT DISTINCT country_code, state_code FROM #{quoted_table}
+ WHERE state_code IS NOT NULL AND country_code IS NOT NULL
SQL
- rows.each do |country_iso, state_code|
- canonical = Spree::IsoData.subdivision_code(country_iso, state_code)
+ rows.each do |country_code, state_code|
+ canonical = Spree::IsoData.subdivision_code(country_code, state_code)
next if canonical.blank? || canonical == state_code
connection.update(<<~SQL.squish)
UPDATE #{quoted_table} SET state_code = #{connection.quote(canonical)}
- WHERE country_iso = #{connection.quote(country_iso)}
+ WHERE country_code = #{connection.quote(country_code)}
AND state_code = #{connection.quote(state_code)}
SQL
end
end
# Country ISO for state members, resolved through the state's own country.
- def backfill_country_iso_from_state(table)
+ def backfill_country_code_from_state(table)
quoted_table = quote(table)
states = quote(STATES_TABLE)
countries = quote(COUNTRIES_TABLE)
sql = <<~SQL.squish
UPDATE #{quoted_table}
- SET country_iso = (
+ SET country_code = (
SELECT #{countries}.iso
FROM #{states}
INNER JOIN #{countries} ON #{countries}.id = #{states}.country_id
WHERE #{states}.id = #{quoted_table}.state_id
)
- WHERE #{quoted_table}.country_iso IS NULL
+ WHERE #{quoted_table}.country_code IS NULL
AND #{quoted_table}.state_id IS NOT NULL
SQL
@@ -212,8 +212,8 @@ namespace :spree do
Run after spree:migrate_zones_to_delivery_zones, so converted zone
members are present to be backfilled.
DESC
- task migrate_country_state_isos: :environment do
- result = Spree::CountryStateIsoMigrator.new.call
+ task migrate_country_state_codes: :environment do
+ result = Spree::CountryStateCodeMigrator.new.call
if result.nil?
puts ' spree_countries not found — nothing to migrate.'
diff --git a/spree/core/lib/tasks/tax_zones_migration.rake b/spree/core/lib/tasks/tax_zones_migration.rake
index c6cd05c88a..9e54eec16a 100644
--- a/spree/core/lib/tasks/tax_zones_migration.rake
+++ b/spree/core/lib/tasks/tax_zones_migration.rake
@@ -15,7 +15,7 @@ namespace :spree do
# reference data rather than records in 6.0, so the ids the members hold
# can only be resolved against the tables the upgrade keeps.
connection = ActiveRecord::Base.connection
- country_iso_by_id = lambda do |id|
+ country_code_by_id = lambda do |id|
connection.select_value("SELECT iso FROM spree_countries WHERE id = #{connection.quote(id)}")
end
state_pair_by_id = lambda do |id|
@@ -25,15 +25,15 @@ namespace :spree do
INNER JOIN spree_countries ON spree_countries.id = spree_states.country_id
WHERE spree_states.id = #{connection.quote(id)}
SQL
- row && { country_iso: row['iso'], state_code: row['abbr'] }
+ row && { country_code: row['iso'], state_code: row['abbr'] }
end
jurisdictions_for = lambda do |zone|
zone.zone_members.filter_map do |member|
case member.zoneable_type
when 'Spree::Country'
- iso = country_iso_by_id.call(member.zoneable_id)
- { country_iso: iso, state_code: nil } if iso
+ iso = country_code_by_id.call(member.zoneable_id)
+ { country_code: iso, state_code: nil } if iso
when 'Spree::State'
state_pair_by_id.call(member.zoneable_id)
end
@@ -45,7 +45,7 @@ namespace :spree do
skipped = 0
Spree::TaxRate.with_deleted.
- where(country_iso: nil, state_code: nil).where.not(zone_id: nil).find_each do |rate|
+ where(country_code: nil, state_code: nil).where.not(zone_id: nil).find_each do |rate|
zone = Spree::Zone.find_by(id: rate.zone_id)
jurisdictions = zone ? jurisdictions_for.call(zone) : []
@@ -62,12 +62,12 @@ namespace :spree do
# now carries a country. The merchant would be short a rate with nothing
# saying so.
ApplicationRecord.transaction do
- rate.update_columns(country_iso: first[:country_iso], state_code: first[:state_code], updated_at: Time.current)
+ rate.update_columns(country_code: first[:country_code], state_code: first[:state_code], updated_at: Time.current)
rest.each do |jurisdiction|
Spree::TaxRate.insert(
rate.attributes.slice(*Spree::TaxRate.column_names).except('id', 'created_at', 'updated_at').merge(
- 'country_iso' => jurisdiction[:country_iso],
+ 'country_code' => jurisdiction[:country_code],
'state_code' => jurisdiction[:state_code],
'created_at' => Time.current,
'updated_at' => Time.current
@@ -91,13 +91,13 @@ namespace :spree do
# re-scoping who pays what, so its price list is deactivated instead and
# reported with the countries it named, for the merchant to rebuild as a
# market. Zones naming states resolve to those states' countries.
- zone_country_isos = lambda do |zone_ids|
+ zone_country_codes = lambda do |zone_ids|
members = Spree::ZoneMember.where(zone_id: zone_ids)
country_ids = members.where(zoneable_type: 'Spree::Country').pluck(:zoneable_id)
state_ids = members.where(zoneable_type: 'Spree::State').pluck(:zoneable_id)
- isos = country_ids.filter_map { |id| country_iso_by_id.call(id) }
- isos += state_ids.filter_map { |id| state_pair_by_id.call(id)&.fetch(:country_iso) }
+ isos = country_ids.filter_map { |id| country_code_by_id.call(id) }
+ isos += state_ids.filter_map { |id| state_pair_by_id.call(id)&.fetch(:country_code) }
isos.uniq.sort
end
@@ -107,17 +107,17 @@ namespace :spree do
Spree::PriceRule.where(type: 'Spree::PriceRules::ZoneRule').find_each do |rule|
stored = rule.preferences.with_indifferent_access
zone_ids = Array(stored[:zone_ids]).reject(&:blank?)
- isos = zone_country_isos.call(zone_ids)
+ isos = zone_country_codes.call(zone_ids)
price_list = Spree::PriceList.with_deleted.find_by(id: rule.price_list_id)
market = if price_list && isos.any?
- price_list.store.markets.find { |candidate| candidate.country_isos == isos }
+ price_list.store.markets.find { |candidate| candidate.country_codes == isos }
end
if market
rule.update_columns(
type: 'Spree::PriceRules::MarketRule',
- preferences: stored.except(:zone_ids, :country_isos).
+ preferences: stored.except(:zone_ids, :country_codes).
merge(market_ids: [market.id.to_s]).to_h.symbolize_keys,
updated_at: Time.current
)
diff --git a/spree/core/spec/lib/tasks/migrate_country_state_isos_spec.rb b/spree/core/spec/lib/tasks/migrate_country_state_codes_spec.rb
similarity index 87%
rename from spree/core/spec/lib/tasks/migrate_country_state_isos_spec.rb
rename to spree/core/spec/lib/tasks/migrate_country_state_codes_spec.rb
index 9ecf163167..385f3a39ce 100644
--- a/spree/core/spec/lib/tasks/migrate_country_state_isos_spec.rb
+++ b/spree/core/spec/lib/tasks/migrate_country_state_codes_spec.rb
@@ -2,11 +2,11 @@ require 'spec_helper'
# The migrator lives in the rake file (it is a one-release upgrade step, not
# engine infrastructure), so load it the way the task does.
-unless defined?(Spree::CountryStateIsoMigrator)
- load Spree::Core::Engine.root.join('lib', 'tasks', 'migrate_country_state_isos.rake')
+unless defined?(Spree::CountryStateCodeMigrator)
+ load Spree::Core::Engine.root.join('lib', 'tasks', 'migrate_country_state_codes.rake')
end
-RSpec.describe Spree::CountryStateIsoMigrator do
+RSpec.describe Spree::CountryStateCodeMigrator do
subject(:migrate) { described_class.new.call }
# Countries and states are reference data in 6.0, so the rows this task reads
@@ -39,7 +39,7 @@ RSpec.describe Spree::CountryStateIsoMigrator do
# Writes the legacy foreign keys and clears the ISO columns, so the row looks
# the way it did before this release.
def as_legacy_row(record, country_id: nil, state_id: nil)
- updates = { country_iso: nil }
+ updates = { country_code: nil }
updates[:country_id] = country_id if connection.column_exists?(record.class.table_name, :country_id)
if connection.column_exists?(record.class.table_name, :state_id)
updates[:state_id] = state_id
@@ -58,7 +58,7 @@ RSpec.describe Spree::CountryStateIsoMigrator do
migrate
- expect(address.reload.country_iso).to eq('PL')
+ expect(address.reload.country_code).to eq('PL')
expect(address.state_code).to eq('DS')
end
@@ -68,7 +68,7 @@ RSpec.describe Spree::CountryStateIsoMigrator do
migrate
- expect(address.reload.country_iso).to eq('PL')
+ expect(address.reload.country_code).to eq('PL')
expect(address.state_code).to be_nil
end
end
@@ -77,37 +77,37 @@ RSpec.describe Spree::CountryStateIsoMigrator do
let(:delivery_zone) { create(:delivery_zone) }
it 'names a country member by code' do
- member = delivery_zone.members.create!(member_type: 'country', country_iso: 'US')
+ member = delivery_zone.members.create!(member_type: 'country', country_code: 'US')
as_legacy_row(member, country_id: country_id)
migrate
- expect(member.reload.country_iso).to eq('PL')
+ expect(member.reload.country_code).to eq('PL')
end
# A subdivision code is only unique within its country, so a state member
# has to record both halves or it cannot be resolved on its own.
it 'gives a state member its country as well' do
- member = delivery_zone.members.create!(member_type: 'state', country_iso: 'US', state_code: 'NY')
+ member = delivery_zone.members.create!(member_type: 'state', country_code: 'US', state_code: 'NY')
as_legacy_row(member, country_id: nil, state_id: state_id)
migrate
expect(member.reload.state_code).to eq('DS')
- expect(member.country_iso).to eq('PL')
+ expect(member.country_code).to eq('PL')
end
end
describe 'other consumers' do
it 'names a market country by code' do
# DE rather than US — the default store's bootstrap market owns US.
- market = create(:market, store: @default_store, country_isos: ['DE'])
+ market = create(:market, store: @default_store, country_codes: ['DE'])
market_country = market.market_countries.first
as_legacy_row(market_country, country_id: country_id)
migrate
- expect(market_country.reload.country_iso).to eq('PL')
+ expect(market_country.reload.country_code).to eq('PL')
end
it 'names a stock location country and state by code' do
@@ -116,20 +116,20 @@ RSpec.describe Spree::CountryStateIsoMigrator do
migrate
- expect(stock_location.reload.country_iso).to eq('PL')
+ expect(stock_location.reload.country_code).to eq('PL')
expect(stock_location.state_code).to eq('DS')
end
it 'names a store default country by code' do
store = create(:store)
# Clears what creation wrote so the backfill is what puts the code back.
- store.update_columns(default_country_id: country_id, default_country_iso_code: nil)
+ store.update_columns(default_country_id: country_id, default_country_code: nil)
migrate
# The store column reflects the legacy foreign key; the market-derived
# reader is separate and unaffected.
- expect(store.reload.read_attribute(:default_country_iso_code)).to eq('PL')
+ expect(store.reload.read_attribute(:default_country_code)).to eq('PL')
end
end
@@ -173,7 +173,7 @@ RSpec.describe Spree::CountryStateIsoMigrator do
it 'leaves already-migrated rows untouched' do
migrate
- expect { described_class.new.call }.not_to change { address.reload.country_iso }
+ expect { described_class.new.call }.not_to change { address.reload.country_code }
end
# An interrupted run leaves some rows filled and some empty; the next run
@@ -184,7 +184,7 @@ RSpec.describe Spree::CountryStateIsoMigrator do
as_legacy_row(other, country_id: country_id, state_id: state_id)
expect(described_class.new.call[:addresses]).to eq(2) # country + state for the one row
- expect(other.reload.country_iso).to eq('PL')
+ expect(other.reload.country_code).to eq('PL')
end
end
end
diff --git a/spree/core/spec/lib/tasks/six_zero_data_migrations_spec.rb b/spree/core/spec/lib/tasks/six_zero_data_migrations_spec.rb
index b60859aa63..33684d8f84 100644
--- a/spree/core/spec/lib/tasks/six_zero_data_migrations_spec.rb
+++ b/spree/core/spec/lib/tasks/six_zero_data_migrations_spec.rb
@@ -260,7 +260,7 @@ describe '6.0 data migration tasks' do
def unconverted_rate(zone, **attributes)
create(:tax_rate, **attributes).tap do |rate|
- rate.update_columns(country_iso: nil, state_code: nil, zone_id: zone.id)
+ rate.update_columns(country_code: nil, state_code: nil, zone_id: zone.id)
end
end
@@ -269,7 +269,7 @@ describe '6.0 data migration tasks' do
run_task('spree:migrate_tax_zones')
- expect(rate.reload.country_iso).to eq(germany.iso)
+ expect(rate.reload.country_code).to eq(germany.iso)
expect(rate.state_code).to be_nil
end
@@ -278,7 +278,7 @@ describe '6.0 data migration tasks' do
expect { run_task('spree:migrate_tax_zones') }.to change(Spree::TaxRate, :count).by(1)
- countries = Spree::TaxRate.where(name: rate.name).map(&:country_iso)
+ countries = Spree::TaxRate.where(name: rate.name).map(&:country_code)
expect(countries).to contain_exactly(germany.iso, france.iso)
expect(Spree::TaxRate.where(name: rate.name).map(&:amount).uniq).to eq([0.19])
end
@@ -289,7 +289,7 @@ describe '6.0 data migration tasks' do
run_task('spree:migrate_tax_zones')
- expect(rate.reload.country_iso).to eq(germany.iso)
+ expect(rate.reload.country_code).to eq(germany.iso)
expect(rate.state_code).to eq(state.abbr)
end
@@ -298,7 +298,7 @@ describe '6.0 data migration tasks' do
run_task('spree:migrate_tax_zones')
- expect(rate.reload.country_iso).to be_nil
+ expect(rate.reload.country_code).to be_nil
end
it 'is idempotent' do
@@ -414,7 +414,7 @@ describe '6.0 data migration tasks' do
expect(delivery_zone.metadata['migrated_from_zone_id']).to eq(zone.id)
expect(delivery_zone.store_id).to eq(delivery_method.store_id)
expect(delivery_zone.delivery_profile_id).to eq(delivery_method.delivery_profile_id)
- expect(delivery_zone.members.pluck(:member_type, :country_iso)).to eq([['country', country.iso]])
+ expect(delivery_zone.members.pluck(:member_type, :country_code)).to eq([['country', country.iso]])
expect(delivery_method.reload.delivery_zone_id).to eq(delivery_zone.id)
end
diff --git a/spree/core/spec/models/concerns/spree/has_iso_geography_spec.rb b/spree/core/spec/models/concerns/spree/has_iso_geography_spec.rb
index 79ba06d038..8623f09873 100644
--- a/spree/core/spec/models/concerns/spree/has_iso_geography_spec.rb
+++ b/spree/core/spec/models/concerns/spree/has_iso_geography_spec.rb
@@ -3,21 +3,21 @@ require 'spec_helper'
# Exercised through hosts rather than an anonymous model — the declarations
# these models make are the contract.
describe Spree::HasIsoGeography, type: :model do
- describe 'country_iso validation' do
+ describe 'country_code validation' do
it 'accepts a known code in any case' do
stock_location = build(:stock_location, country: nil, state: nil)
- stock_location.country_iso = 'us'
+ stock_location.country_code = 'us'
expect(stock_location).to be_valid
- expect(stock_location.country_iso).to eq('US')
+ expect(stock_location.country_code).to eq('US')
end
it 'rejects a code nothing recognises' do
stock_location = build(:stock_location, country: nil, state: nil)
- stock_location.country_iso = 'ZZ'
+ stock_location.country_code = 'ZZ'
expect(stock_location).not_to be_valid
- expect(stock_location.errors[:country_iso]).to be_present
+ expect(stock_location.errors[:country_code]).to be_present
end
it 'leaves a blank code to the presence rules of the host' do
@@ -25,26 +25,26 @@ describe Spree::HasIsoGeography, type: :model do
end
it 'guards country-only hosts too' do
- market_country = Spree::MarketCountry.new(market: create(:market), country_iso: 'ZZ')
+ market_country = Spree::MarketCountry.new(market: create(:market), country_code: 'ZZ')
expect(market_country).not_to be_valid
- expect(market_country.errors[:country_iso]).to be_present
+ expect(market_country.errors[:country_code]).to be_present
end
end
describe 'state_code validation' do
it 'accepts a subdivision of the country' do
- expect(build(:stock_location, country_iso: 'US', state_code: 'NY')).to be_valid
+ expect(build(:stock_location, country_code: 'US', state_code: 'NY')).to be_valid
end
it 'accepts a retired code that resolves through its successor' do
- stock_location = build(:stock_location, country: nil, state: nil, country_iso: 'IN', state_code: 'OR')
+ stock_location = build(:stock_location, country: nil, state: nil, country_code: 'IN', state_code: 'OR')
expect(stock_location).to be_valid
end
it 'rejects a code that is no subdivision of the country' do
- stock_location = build(:stock_location, country: nil, state: nil, country_iso: 'US', state_code: 'ZZ')
+ stock_location = build(:stock_location, country: nil, state: nil, country_code: 'US', state_code: 'ZZ')
expect(stock_location).not_to be_valid
expect(stock_location.errors[:state_code]).to be_present
@@ -55,10 +55,10 @@ describe Spree::HasIsoGeography, type: :model do
end
it 'reports only the country when both codes are unrecognisable' do
- stock_location = build(:stock_location, country: nil, state: nil, country_iso: 'ZZ', state_code: 'QQ')
+ stock_location = build(:stock_location, country: nil, state: nil, country_code: 'ZZ', state_code: 'QQ')
expect(stock_location).not_to be_valid
- expect(stock_location.errors[:country_iso]).to be_present
+ expect(stock_location.errors[:country_code]).to be_present
expect(stock_location.errors[:state_code]).to be_blank
end
end
@@ -68,7 +68,7 @@ describe Spree::HasIsoGeography, type: :model do
# resolving must not wedge the record on unrelated updates.
it 'stays updatable when a stored code no longer resolves' do
stock_location = create(:stock_location)
- stock_location.update_columns(country_iso: 'ZZ', state_code: 'QQ')
+ stock_location.update_columns(country_code: 'ZZ', state_code: 'QQ')
stock_location.reload
expect(stock_location.update(name: 'Renamed warehouse')).to be(true)
@@ -76,11 +76,11 @@ describe Spree::HasIsoGeography, type: :model do
it 'validates again once the code itself changes' do
stock_location = create(:stock_location)
- stock_location.update_columns(country_iso: 'ZZ')
+ stock_location.update_columns(country_code: 'ZZ')
stock_location.reload
- expect(stock_location.update(country_iso: 'YY')).to be(false)
- expect(stock_location.errors[:country_iso]).to be_present
+ expect(stock_location.update(country_code: 'YY')).to be(false)
+ expect(stock_location.errors[:country_code]).to be_present
end
end
end
diff --git a/spree/core/spec/models/concerns/spree/vat_price_calculation_spec.rb b/spree/core/spec/models/concerns/spree/vat_price_calculation_spec.rb
index b3ab5fc2bf..bde405ec6d 100644
--- a/spree/core/spec/models/concerns/spree/vat_price_calculation_spec.rb
+++ b/spree/core/spec/models/concerns/spree/vat_price_calculation_spec.rb
@@ -17,7 +17,7 @@ describe Spree::VatPriceCalculation, type: :model do
before do
home_market.update!(countries: [germany])
create(:tax_rate, name: 'DE 19% incl', amount: 0.19, tax_category: category,
- country_iso: germany&.iso, included_in_price: true, store: store)
+ country_code: germany&.iso, included_in_price: true, store: store)
end
let(:variant) { create(:variant, price: 100, product: create(:product, tax_category: category)) }
@@ -33,7 +33,7 @@ describe Spree::VatPriceCalculation, type: :model do
it 'restates for a destination with its own rate, preserving the net' do
create(:tax_rate, name: 'FR 20% incl', amount: 0.20, tax_category: category,
- country_iso: france&.iso, included_in_price: true, store: store)
+ country_code: france&.iso, included_in_price: true, store: store)
# net 100 / 1.19 = 84.0336, grossed by 1.20
expect(gross_for(france)).to eq(100.84)
@@ -58,14 +58,14 @@ describe Spree::VatPriceCalculation, type: :model do
# Germany, which the home market owns — one country, one market per store.
create(:market, store: store, name: "External #{Time.current.to_f}", currency: 'USD',
default_locale: 'en', tax_provider: 'SpecExternalTaxProvider',
- country_isos: %w[US])
+ country_codes: %w[US])
end
after { Spree.tax_providers.delete(SpecExternalTaxProvider) if defined?(SpecExternalTaxProvider) }
it 'does not restate at all' do
create(:tax_rate, name: 'FR 20% incl', amount: 0.20, tax_category: category,
- country_iso: france&.iso, included_in_price: true, store: store)
+ country_code: france&.iso, included_in_price: true, store: store)
expect(gross_for(france, market: external_market)).to eq(100.00)
end
@@ -86,7 +86,7 @@ describe Spree::VatPriceCalculation, type: :model do
before do
create(:tax_rate, name: 'FR 20% incl', amount: 0.20, tax_category: category,
- country_iso: france&.iso, included_in_price: true, store: store)
+ country_code: france&.iso, included_in_price: true, store: store)
end
it 'restates from the market country, keeping the net intact' do
@@ -119,7 +119,7 @@ describe Spree::VatPriceCalculation, type: :model do
before do
create(:tax_rate, name: 'FR 20% incl', amount: 0.20, tax_category: category,
- country_iso: france&.iso, included_in_price: true, store: store)
+ country_code: france&.iso, included_in_price: true, store: store)
end
it 'is charged exactly as entered' do
@@ -145,7 +145,7 @@ describe Spree::VatPriceCalculation, type: :model do
before do
create(:tax_rate, name: 'FR 20% incl', amount: 0.20, tax_category: category,
- country_iso: france&.iso, included_in_price: true, store: store)
+ country_code: france&.iso, included_in_price: true, store: store)
end
# A market rule with nothing selected matches everyone, which is the state the
diff --git a/spree/core/spec/models/spree/address_spec.rb b/spree/core/spec/models/spree/address_spec.rb
index 4b57feac46..b4d0cd338b 100644
--- a/spree/core/spec/models/spree/address_spec.rb
+++ b/spree/core/spec/models/spree/address_spec.rb
@@ -64,7 +64,7 @@ describe Spree::Address, type: :model do
expect(cloned.address2).to eq(original.address2)
expect(cloned.alternative_phone).to eq(original.alternative_phone)
expect(cloned.city).to eq(original.city)
- expect(cloned.country_iso).to eq(original.country_iso)
+ expect(cloned.country_code).to eq(original.country_code)
expect(cloned.firstname).to eq(original.firstname)
expect(cloned.lastname).to eq(original.lastname)
expect(cloned.company).to eq(original.company)
@@ -99,9 +99,9 @@ describe Spree::Address, type: :model do
end
end
- context '#country_iso' do
+ context '#country_code' do
it 'return proper country_iso_name' do
- expect(address.country_iso).to eq 'US'
+ expect(address.country_code).to eq 'US'
end
end
@@ -137,7 +137,7 @@ describe Spree::Address, type: :model do
let(:address) { build(:address, country: country, state: nil) }
it 'state_name is not nil and country does not have any states' do
- address.country_iso = stateless_country.iso
+ address.country_code = stateless_country.iso
address.zipcode = Spree::TestingSupport::CountryPool.postal_code_for('PL')
address.state_code = nil
address.state_name = 'Somewhere'
@@ -166,7 +166,7 @@ describe Spree::Address, type: :model do
it 'state is entered but country does not contain that state' do
address.state_code = state.abbr
- address.country_iso = 'CA'
+ address.country_code = 'CA'
address.zipcode = Spree::TestingSupport::CountryPool.postal_code_for('CA')
address.valid?
# The Maryland code means nothing in Canada, so it is dropped and the
@@ -177,7 +177,7 @@ describe Spree::Address, type: :model do
it 'both state and state_name are entered but country does not contain the state' do
address.state_code = state.abbr
address.state_name = 'maryland'
- address.country_iso = stateless_country.iso
+ address.country_code = stateless_country.iso
address.zipcode = Spree::TestingSupport::CountryPool.postal_code_for('PL')
expect(address).to be_valid
expect(address.state_abbr).to be_nil
@@ -191,7 +191,7 @@ describe Spree::Address, type: :model do
end
it 'does not require a state when the country does not require one' do
- address.country_iso = stateless_country.iso
+ address.country_code = stateless_country.iso
address.zipcode = Spree::TestingSupport::CountryPool.postal_code_for(stateless_country.iso)
address.state_code = nil
address.state_name = nil
@@ -270,7 +270,7 @@ describe Spree::Address, type: :model do
end
it 'accepts an unformatted zip code' do
- address.country_iso = 'GB'
+ address.country_code = 'GB'
address.zipcode = ' AL38QE'
address.valid?
expect(address.errors['zipcode']).not_to include('is invalid')
@@ -285,7 +285,7 @@ describe Spree::Address, type: :model do
end
it 'does not have a country' do
- address.country_iso = nil
+ address.country_code = nil
address.valid?
expect(address.errors['zipcode']).not_to include('is invalid')
end
@@ -397,17 +397,17 @@ describe Spree::Address, type: :model do
end
end
- describe '#country_iso' do
+ describe '#country_code' do
let(:address) { build(:address, country: country) }
let(:country) { Spree::Country.by_iso('US') }
it 'returns the country iso' do
- expect(address.country_iso).to eq('US')
+ expect(address.country_code).to eq('US')
end
it 'returns nil if the country is nil' do
- address.country_iso = nil
- expect(address.country_iso).to be_nil
+ address.country_code = nil
+ expect(address.country_code).to be_nil
end
end
@@ -465,7 +465,7 @@ describe Spree::Address, type: :model do
before do
# Japan's subdivision codes are numeric, so a US code cannot
# coincidentally be valid there.
- address.country_iso = 'JP'
+ address.country_code = 'JP'
address.zipcode = Spree::TestingSupport::CountryPool.postal_code_for('JP')
clear_state_entities
end
@@ -490,7 +490,7 @@ describe Spree::Address, type: :model do
context 'when country has no states and state is required' do
before do
- address.country_iso = 'US'
+ address.country_code = 'US'
clear_state_entities
end
@@ -511,7 +511,7 @@ describe Spree::Address, type: :model do
context 'when country has no states and state is not required' do
before do
# Hong Kong genuinely has no subdivisions in the ISO data.
- address.country_iso = 'HK'
+ address.country_code = 'HK'
address.state_name = state.name
clear_state_entities
end
@@ -813,21 +813,21 @@ describe Spree::Address, type: :model do
end
end
- describe 'country_iso= and state_code= writer methods' do
+ describe 'country_code= and state_code= writer methods' do
let(:country) { Spree::Country.by_iso('US') }
let!(:state) { Spree::State.resolve(country.iso, 'NY') }
- describe '#country_iso=' do
+ describe '#country_code=' do
it 'sets country from ISO code on validation' do
address = build(:address, country: nil)
- address.country_iso = 'US'
+ address.country_code = 'US'
address.valid?
expect(address.country).to eq(country)
end
it 'is case-insensitive' do
address = build(:address, country: nil)
- address.country_iso = 'us'
+ address.country_code = 'us'
address.valid?
expect(address.country).to eq(country)
end
@@ -835,21 +835,21 @@ describe Spree::Address, type: :model do
it 'clears the country when blank — a posted empty value means empty' do
original_country = create(:country)
address = build(:address, country: original_country)
- address.country_iso = ''
+ address.country_code = ''
address.valid?
expect(address.country).to be_nil
end
it 'sets country to nil when ISO is not found' do
address = build(:address, country: nil)
- address.country_iso = 'XX'
+ address.country_code = 'XX'
address.valid?
expect(address.country).to be_nil
end
it 'clears the input after normalization' do
address = build(:address, country: nil)
- address.country_iso = 'US'
+ address.country_code = 'US'
address.valid?
# The input should be cleared so it doesn't re-run on next validation
address.valid?
@@ -898,10 +898,10 @@ describe Spree::Address, type: :model do
end
end
- describe 'combined country_iso and state_abbr' do
+ describe 'combined country_code and state_abbr' do
it 'sets both country and state when both are provided' do
address = build(:address, country: nil, state: nil)
- address.country_iso = 'US'
+ address.country_code = 'US'
address.state_abbr = 'NY'
address.valid?
expect(address.country).to eq(country)
@@ -916,7 +916,7 @@ describe Spree::Address, type: :model do
city: 'New York',
zipcode: '10001',
phone: '555-1234',
- country_iso: 'US',
+ country_code: 'US',
state_abbr: 'NY'
)
expect(address).to be_valid
@@ -926,7 +926,7 @@ describe Spree::Address, type: :model do
it 'works with address update via assign_attributes' do
address = create(:address)
- address.assign_attributes(country_iso: 'US', state_abbr: 'NY')
+ address.assign_attributes(country_code: 'US', state_abbr: 'NY')
address.valid?
expect(address.country).to eq(country)
expect(address.state).to eq(state)
diff --git a/spree/core/spec/models/spree/base_spec.rb b/spree/core/spec/models/spree/base_spec.rb
index 6852f11fa8..7cf079587f 100644
--- a/spree/core/spec/models/spree/base_spec.rb
+++ b/spree/core/spec/models/spree/base_spec.rb
@@ -99,11 +99,11 @@ describe Spree::Base do
expect(Spree.customer_class.json_api_columns).to include('email')
end
- it { expect(Spree::Address.json_api_columns).to contain_exactly('address1', 'address2', 'alternative_phone', 'city', 'company', 'country_iso', 'created_at', 'deleted_at', 'firstname', 'label', 'lastname', 'phone', 'state_code', 'state_name', 'updated_at', 'zipcode', 'metadata', 'quick_checkout', 'latitude', 'longitude') }
+ it { expect(Spree::Address.json_api_columns).to contain_exactly('address1', 'address2', 'alternative_phone', 'city', 'company', 'country_code', 'created_at', 'deleted_at', 'firstname', 'label', 'lastname', 'phone', 'state_code', 'state_name', 'updated_at', 'zipcode', 'metadata', 'quick_checkout', 'latitude', 'longitude') }
it { expect(Spree::Address.json_api_columns).not_to include('country_id') }
end
describe '.json_api_permitted_attributes' do
- it { expect(Spree::Address.json_api_permitted_attributes).to contain_exactly('firstname', 'lastname', 'address1', 'address2', 'city', 'zipcode', 'phone', 'country_iso', 'state_code', 'state_name', 'alternative_phone', 'company', 'country_id', 'state_id', 'created_at', 'updated_at', 'customer_id', 'deleted_at', 'label', 'metadata', 'quick_checkout', 'latitude', 'longitude') }
+ it { expect(Spree::Address.json_api_permitted_attributes).to contain_exactly('firstname', 'lastname', 'address1', 'address2', 'city', 'zipcode', 'phone', 'country_code', 'state_code', 'state_name', 'alternative_phone', 'company', 'country_id', 'state_id', 'created_at', 'updated_at', 'customer_id', 'deleted_at', 'label', 'metadata', 'quick_checkout', 'latitude', 'longitude') }
end
end
diff --git a/spree/core/spec/models/spree/concerns/vat_price_calculation_spec.rb b/spree/core/spec/models/spree/concerns/vat_price_calculation_spec.rb
index 6561afb122..32ede557a8 100644
--- a/spree/core/spec/models/spree/concerns/vat_price_calculation_spec.rb
+++ b/spree/core/spec/models/spree/concerns/vat_price_calculation_spec.rb
@@ -56,9 +56,9 @@ module Spree
context 'and the destination is elsewhere' do
it 'takes the home VAT out and puts the destination VAT on' do
- create(:tax_rate, country_iso: home_country&.iso, tax_category: tax_category, amount: 0.19,
+ create(:tax_rate, country_code: home_country&.iso, tax_category: tax_category, amount: 0.19,
included_in_price: true)
- create(:tax_rate, country_iso: destination&.iso, tax_category: tax_category, amount: 0.25,
+ create(:tax_rate, country_code: destination&.iso, tax_category: tax_category, amount: 0.25,
included_in_price: true)
# 100 gross at 19% is 84.03 net, which is 105.04 gross at 25%.
diff --git a/spree/core/spec/models/spree/delivery_rate_spec.rb b/spree/core/spec/models/spree/delivery_rate_spec.rb
index cf6ed9be1d..cad59b61a0 100644
--- a/spree/core/spec/models/spree/delivery_rate_spec.rb
+++ b/spree/core/spec/models/spree/delivery_rate_spec.rb
@@ -30,7 +30,7 @@ describe Spree::DeliveryRate, type: :model do
name: 'VAT',
amount: 0.1,
included_in_price: true,
- country_iso: @default_country&.iso
+ country_code: @default_country&.iso
end
context 'when the rate taxes the home country' do
@@ -58,7 +58,7 @@ describe Spree::DeliveryRate, type: :model do
name: 'VAT',
amount: 0.2,
included_in_price: true,
- country_iso: create(:country, iso: 'FR', name: 'France')&.iso
+ country_code: create(:country, iso: 'FR', name: 'France')&.iso
end
before { shipping_rate.tax_rate = non_default_tax_rate }
diff --git a/spree/core/spec/models/spree/line_item_spec.rb b/spree/core/spec/models/spree/line_item_spec.rb
index eeb20e30a6..5ccbfe74ed 100644
--- a/spree/core/spec/models/spree/line_item_spec.rb
+++ b/spree/core/spec/models/spree/line_item_spec.rb
@@ -265,7 +265,7 @@ describe Spree::LineItem, type: :model do
let(:variant) { create(:variant) }
before do
- create(:tax_rate, country_iso: rate_country&.iso, tax_category: variant.tax_category)
+ create(:tax_rate, country_code: rate_country&.iso, tax_category: variant.tax_category)
end
context 'when a rate covers the order destination' do
diff --git a/spree/core/spec/models/spree/market_country_spec.rb b/spree/core/spec/models/spree/market_country_spec.rb
index def6bfc476..9199499f2f 100644
--- a/spree/core/spec/models/spree/market_country_spec.rb
+++ b/spree/core/spec/models/spree/market_country_spec.rb
@@ -11,12 +11,12 @@ RSpec.describe Spree::MarketCountry, type: :model do
let!(:zone) { create(:delivery_zone) }
before do
- zone.members.create!(member_type: 'country', country_iso: country.iso)
+ zone.members.create!(member_type: 'country', country_code: country.iso)
create(:shipping_method, delivery_zone: zone)
end
it 'is valid' do
- market_country = Spree::MarketCountry.new(market: market, country_iso: country.iso)
+ market_country = Spree::MarketCountry.new(market: market, country_code: country.iso)
expect(market_country).to be_valid
end
end
@@ -28,12 +28,12 @@ RSpec.describe Spree::MarketCountry, type: :model do
market # instantiate first — the factory may add a worldwide method
# scope any worldwide methods (e.g. the market factory's) elsewhere
elsewhere = create(:delivery_zone)
- elsewhere.members.create!(member_type: 'country', country_iso: create(:country).iso)
+ elsewhere.members.create!(member_type: 'country', country_code: create(:country).iso)
Spree::DeliveryMethod.find_each { |dm| dm.update!(delivery_zone: elsewhere) if dm.delivery_zone.nil? }
end
it 'is invalid' do
- market_country = Spree::MarketCountry.new(market: market, country_iso: country.iso)
+ market_country = Spree::MarketCountry.new(market: market, country_code: country.iso)
expect(market_country).not_to be_valid
expect(market_country.errors[:country]).to include(/not covered by any shipping zone/)
end
@@ -45,14 +45,14 @@ RSpec.describe Spree::MarketCountry, type: :model do
before do
market # instantiate first — the factory may add a worldwide method
- zone.members.create!(member_type: 'country', country_iso: country.iso)
+ zone.members.create!(member_type: 'country', country_code: country.iso)
elsewhere = create(:delivery_zone)
- elsewhere.members.create!(member_type: 'country', country_iso: create(:country).iso)
+ elsewhere.members.create!(member_type: 'country', country_code: create(:country).iso)
Spree::DeliveryMethod.find_each { |dm| dm.update!(delivery_zone: elsewhere) if dm.delivery_zone.nil? }
end
it 'is invalid' do
- market_country = Spree::MarketCountry.new(market: market, country_iso: country.iso)
+ market_country = Spree::MarketCountry.new(market: market, country_code: country.iso)
expect(market_country).not_to be_valid
expect(market_country.errors[:country]).to include(/not covered by any shipping zone/)
end
@@ -64,12 +64,12 @@ RSpec.describe Spree::MarketCountry, type: :model do
let!(:zone) { create(:delivery_zone) }
before do
- zone.members.create!(member_type: 'state', country_iso: state.country_iso, state_code: state.abbr)
+ zone.members.create!(member_type: 'state', country_code: state.country_code, state_code: state.abbr)
create(:shipping_method, delivery_zone: zone)
end
it 'is valid' do
- market_country = Spree::MarketCountry.new(market: market, country_iso: country.iso)
+ market_country = Spree::MarketCountry.new(market: market, country_code: country.iso)
expect(market_country).to be_valid
end
end
@@ -83,7 +83,7 @@ RSpec.describe Spree::MarketCountry, type: :model do
it 'prevents assigning same country to another market in the same store' do
market1 # ensure it exists
market2 = create(:market, store: store)
- market_country = Spree::MarketCountry.new(market: market2, country_iso: country.iso)
+ market_country = Spree::MarketCountry.new(market: market2, country_code: country.iso)
expect(market_country).not_to be_valid
expect(market_country.errors[:country]).to include(/already assigned to another market/)
end
diff --git a/spree/core/spec/models/spree/market_spec.rb b/spree/core/spec/models/spree/market_spec.rb
index 62dd1f0e16..f73f3059ce 100644
--- a/spree/core/spec/models/spree/market_spec.rb
+++ b/spree/core/spec/models/spree/market_spec.rb
@@ -129,74 +129,74 @@ RSpec.describe Spree::Market, type: :model do
end
end
- describe '#country_isos' do
+ describe '#country_codes' do
it 'returns the sorted ISO codes for assigned countries' do
de = create(:country, iso: 'DE', name: 'Germany')
fr = create(:country, iso: 'FR', name: 'France')
market = create(:market, store: store, countries: [fr, de])
- expect(market.country_isos).to eq(%w[DE FR])
+ expect(market.country_codes).to eq(%w[DE FR])
end
it 'returns an empty array when no countries are assigned' do
market = build(:market, store: store, countries: [])
- expect(market.country_isos).to eq([])
+ expect(market.country_codes).to eq([])
end
- it 'reflects updates made via country_isos=' do
+ it 'reflects updates made via country_codes=' do
create(:country, iso: 'DE', name: 'Germany')
create(:country, iso: 'FR', name: 'France')
market = build(:market, store: store, countries: [])
- market.country_isos = %w[FR DE]
- expect(market.country_isos).to eq(%w[DE FR])
+ market.country_codes = %w[FR DE]
+ expect(market.country_codes).to eq(%w[DE FR])
end
it 'round-trips through save/reload' do
de = create(:country, iso: 'DE', name: 'Germany')
fr = create(:country, iso: 'FR', name: 'France')
market = create(:market, store: store, countries: [de, fr])
- expect(market.reload.country_isos).to eq(%w[DE FR])
+ expect(market.reload.country_codes).to eq(%w[DE FR])
end
end
- describe '#country_isos=' do
+ describe '#country_codes=' do
let!(:de) { create(:country, iso: 'DE', name: 'Germany') }
let!(:fr) { create(:country, iso: 'FR', name: 'France') }
let!(:italy) { create(:country, iso: 'IT', name: 'Italy') }
it 'resolves ISO codes to Country records' do
market = build(:market, store: store, countries: [])
- market.country_isos = %w[DE FR]
+ market.country_codes = %w[DE FR]
expect(market.countries).to contain_exactly(de, fr)
end
it 'is case-insensitive' do
market = build(:market, store: store, countries: [])
- market.country_isos = %w[de fr]
+ market.country_codes = %w[de fr]
expect(market.countries).to contain_exactly(de, fr)
end
it 'silently drops unknown codes' do
market = build(:market, store: store, countries: [])
- market.country_isos = %w[DE XX FR]
+ market.country_codes = %w[DE XX FR]
expect(market.countries).to contain_exactly(de, fr)
end
it 'replaces the existing country list (full-set update)' do
market = build(:market, store: store, countries: [de, fr])
- market.country_isos = %w[IT]
+ market.country_codes = %w[IT]
expect(market.countries).to contain_exactly(italy)
end
it 'clears all countries when given an empty array' do
market = build(:market, store: store, countries: [de])
- market.country_isos = []
+ market.country_codes = []
expect(market.countries).to be_empty
end
it 'strips blanks and nils' do
market = build(:market, store: store, countries: [])
- market.country_isos = ['DE', '', nil, 'FR']
+ market.country_codes = ['DE', '', nil, 'FR']
expect(market.countries).to contain_exactly(de, fr)
end
end
diff --git a/spree/core/spec/models/spree/order/adjustments_spec.rb b/spree/core/spec/models/spree/order/adjustments_spec.rb
index b0e67d1fd7..8c43afa7e0 100644
--- a/spree/core/spec/models/spree/order/adjustments_spec.rb
+++ b/spree/core/spec/models/spree/order/adjustments_spec.rb
@@ -38,7 +38,7 @@ describe Spree::Order do
amount: 0.2,
included_in_price: true,
tax_category: tax_category,
- country_iso: country&.iso
+ country_code: country&.iso
)
}
let!(:shipping_method) do
diff --git a/spree/core/spec/models/spree/promotion/rules/country_spec.rb b/spree/core/spec/models/spree/promotion/rules/country_spec.rb
index f12cb25c02..82e07e8877 100644
--- a/spree/core/spec/models/spree/promotion/rules/country_spec.rb
+++ b/spree/core/spec/models/spree/promotion/rules/country_spec.rb
@@ -8,18 +8,18 @@ describe Spree::Promotion::Rules::Country, type: :model do
let(:other_country) { create(:country) }
context 'preferred country_id is set' do
- before { rule.preferred_country_iso = country.iso }
+ before { rule.preferred_country_code = country.iso }
it 'is eligible for correct country' do
allow(order).to receive_message_chain(:ship_address, :country_id) { country.id }
- allow(order).to receive_message_chain(:ship_address, :country_iso) { country.iso }
+ allow(order).to receive_message_chain(:ship_address, :country_code) { country.iso }
expect(rule).to be_eligible(order)
end
it 'is not eligible for incorrect country' do
allow(order).to receive_message_chain(:ship_address, :country_id) { other_country.id }
- allow(order).to receive_message_chain(:ship_address, :country_iso) { other_country.iso }
+ allow(order).to receive_message_chain(:ship_address, :country_code) { other_country.iso }
expect(rule).not_to be_eligible(order)
@@ -28,12 +28,12 @@ describe Spree::Promotion::Rules::Country, type: :model do
end
end
- context 'preferred country_iso is set' do
- before { rule.preferred_country_iso = country.iso }
+ context 'preferred country_code is set' do
+ before { rule.preferred_country_code = country.iso }
it 'is eligible for correct country' do
allow(order).to receive_message_chain(:ship_address, :country_id) { country.id }
- allow(order).to receive_message_chain(:ship_address, :country_iso) { country.iso }
+ allow(order).to receive_message_chain(:ship_address, :country_code) { country.iso }
expect(rule).to be_eligible(order)
expect(rule.eligibility_errors).to be_empty
@@ -41,7 +41,7 @@ describe Spree::Promotion::Rules::Country, type: :model do
it 'is not eligible for incorrect country' do
allow(order).to receive_message_chain(:ship_address, :country_id) { other_country.id }
- allow(order).to receive_message_chain(:ship_address, :country_iso) { other_country.iso }
+ allow(order).to receive_message_chain(:ship_address, :country_code) { other_country.iso }
expect(rule).not_to be_eligible(order)
@@ -53,14 +53,14 @@ describe Spree::Promotion::Rules::Country, type: :model do
context 'preferred country is not set' do
it 'is eligible for default country' do
allow(order).to receive_message_chain(:ship_address, :country_id) { other_country.id }
- allow(order).to receive_message_chain(:ship_address, :country_iso) { other_country.iso }
+ allow(order).to receive_message_chain(:ship_address, :country_code) { other_country.iso }
expect(rule).to be_eligible(order)
end
it 'is not eligible for incorrect country' do
allow(order).to receive_message_chain(:ship_address, :country_id) { country.id }
- allow(order).to receive_message_chain(:ship_address, :country_iso) { country.iso }
+ allow(order).to receive_message_chain(:ship_address, :country_code) { country.iso }
expect(rule).not_to be_eligible(order)
diff --git a/spree/core/spec/models/spree/promotion_handler/coupon_spec.rb b/spree/core/spec/models/spree/promotion_handler/coupon_spec.rb
index 44b61c3445..9fcacb3596 100644
--- a/spree/core/spec/models/spree/promotion_handler/coupon_spec.rb
+++ b/spree/core/spec/models/spree/promotion_handler/coupon_spec.rb
@@ -225,7 +225,7 @@ module Spree
context 'for an order with taxable line items' do
let!(:order) { create(:order, line_items_price: 0.0, store: store) }
let!(:tax_category) { create(:tax_category, name: 'Taxable Foo') }
- let!(:rate) { create(:tax_rate, amount: 0.10, tax_category: tax_category, country_iso: @default_country&.iso) }
+ let!(:rate) { create(:tax_rate, amount: 0.10, tax_category: tax_category, country_code: @default_country&.iso) }
context 'and the product price is less than promo discount' do
diff --git a/spree/core/spec/models/spree/promotion_tax_recalculation_spec.rb b/spree/core/spec/models/spree/promotion_tax_recalculation_spec.rb
index 427f65963f..e8130a8784 100644
--- a/spree/core/spec/models/spree/promotion_tax_recalculation_spec.rb
+++ b/spree/core/spec/models/spree/promotion_tax_recalculation_spec.rb
@@ -74,7 +74,7 @@ xdescribe 'Promotion discounts and the taxable basis', type: :model do
context 'with additional (US-style) tax of 10%' do
let(:item_price) { 250 }
let!(:tax_rate) do
- create(:tax_rate, country_iso: @default_country&.iso, tax_category: tax_category, amount: 0.10, included_in_price: false)
+ create(:tax_rate, country_code: @default_country&.iso, tax_category: tax_category, amount: 0.10, included_in_price: false)
end
before { build_cart! }
@@ -162,7 +162,7 @@ xdescribe 'Promotion discounts and the taxable basis', type: :model do
context 'with included (VAT-style) tax of 20%' do
let(:item_price) { 350 }
let!(:tax_rate) do
- create(:tax_rate, country_iso: @default_country&.iso, tax_category: tax_category, amount: 0.20, included_in_price: true)
+ create(:tax_rate, country_code: @default_country&.iso, tax_category: tax_category, amount: 0.20, included_in_price: true)
end
before { build_cart! }
diff --git a/spree/core/spec/models/spree/stock/estimator_spec.rb b/spree/core/spec/models/spree/stock/estimator_spec.rb
index 2bcc9e2598..ebaeb1bb00 100644
--- a/spree/core/spec/models/spree/stock/estimator_spec.rb
+++ b/spree/core/spec/models/spree/stock/estimator_spec.rb
@@ -83,7 +83,7 @@ module Spree
# Any real country the order doesn't ship to — the address factory
# ships to the US, and invented codes don't resolve any more.
zone = create(:delivery_zone)
- zone.members.create!(member_type: 'country', country_iso: 'JP')
+ zone.members.create!(member_type: 'country', country_code: 'JP')
shipping_method.update!(delivery_zone: zone)
end
@@ -196,7 +196,7 @@ module Spree
end
context 'includes tax adjustments if applicable' do
- let!(:tax_rate) { create(:tax_rate, country_iso: order.tax_address.country&.iso) }
+ let!(:tax_rate) { create(:tax_rate, country_code: order.tax_address.country&.iso) }
before do
Spree::ShippingMethod.all.each do |sm|
@@ -221,7 +221,7 @@ module Spree
let!(:default_vat) do
create :tax_rate,
included_in_price: true,
- country_iso: home_country&.iso,
+ country_code: home_country&.iso,
amount: 0.2,
tax_category: shipping_method.tax_category
end
@@ -259,7 +259,7 @@ module Spree
let!(:other_vat) do
create :tax_rate,
included_in_price: true,
- country_iso: other_country&.iso,
+ country_code: other_country&.iso,
amount: 0.3,
tax_category: shipping_method.tax_category
end
diff --git a/spree/core/spec/models/spree/stock_location_spec.rb b/spree/core/spec/models/spree/stock_location_spec.rb
index 53913f9b0c..059f74178e 100644
--- a/spree/core/spec/models/spree/stock_location_spec.rb
+++ b/spree/core/spec/models/spree/stock_location_spec.rb
@@ -287,7 +287,7 @@ module Spree
end
context 'a state code is present' do
- subject { described_class.create(name: 'testing', country_iso: 'US', state_code: 'VA', state_name: nil) }
+ subject { described_class.create(name: 'testing', country_code: 'US', state_code: 'VA', state_name: nil) }
specify { expect(subject.state_text).to eq('VA') }
end
@@ -339,7 +339,7 @@ module Spree
subject { build(:stock_location, country: nil, state: nil) }
it { expect(subject.country_name).to be_nil }
- it { expect(subject.country_iso).to be_nil }
+ it { expect(subject.country_code).to be_nil }
it { expect(subject.country_iso3).to be_nil }
it { expect(subject.country_iso_name).to be_nil }
end
@@ -408,19 +408,19 @@ module Spree
end
end
- describe '#country_iso=' do
+ describe '#country_code=' do
let(:country) { Spree::Country.by_iso('US') }
let(:stock_location) { build(:stock_location, country: nil, state: nil) }
it 'resolves the country from an ISO code on validation' do
- stock_location.country_iso = country.iso
+ stock_location.country_code = country.iso
stock_location.valid?
expect(stock_location.country).to eq(country)
end
it 'clears the country when blank' do
- stock_location.country_iso = country.iso
- stock_location.country_iso = ''
+ stock_location.country_code = country.iso
+ stock_location.country_code = ''
stock_location.valid?
expect(stock_location.country).to be_nil
end
@@ -444,7 +444,7 @@ module Spree
end
it 'resolves nothing without a country — a subdivision code is only unique within one' do
- stock_location.country_iso = nil
+ stock_location.country_code = nil
stock_location.state_code = 'NY'
stock_location.valid?
expect(stock_location.state).to be_nil
diff --git a/spree/core/spec/models/spree/store_spec.rb b/spree/core/spec/models/spree/store_spec.rb
index 5b382f6924..9af3228508 100644
--- a/spree/core/spec/models/spree/store_spec.rb
+++ b/spree/core/spec/models/spree/store_spec.rb
@@ -293,15 +293,15 @@ describe Spree::Store, type: :model, without_global_store: true do
end
describe '#ensure_default_market' do
- context 'when default_country_iso is set with shipping coverage' do
+ context 'when default_country_code is set with shipping coverage' do
let(:country) { Spree::Country.by_iso('US') }
let(:store) { build(:store) }
before do
zone = create(:delivery_zone)
- zone.members.create!(member_type: 'country', country_iso: country.iso)
+ zone.members.create!(member_type: 'country', country_code: country.iso)
create(:shipping_method, delivery_zone: zone)
- store.default_country_iso = country.iso
+ store.default_country_code = country.iso
end
it 'creates a default market named after the country' do
@@ -319,7 +319,7 @@ describe Spree::Store, type: :model, without_global_store: true do
end
end
- context 'when default_country_iso is not set' do
+ context 'when default_country_code is not set' do
let(:store) { build(:store) }
it 'creates a fallback default market so the store always owns one' do
@@ -526,7 +526,7 @@ describe Spree::Store, type: :model, without_global_store: true do
let!(:country) { Spree::Country.by_iso('US') }
let(:store) { build(:store) }
- before { store.write_attribute(:default_country_iso_code, country.iso) }
+ before { store.write_attribute(:default_country_code, country.iso) }
it 'returns the store column value' do
expect(store.default_country).to eq(country)
@@ -534,18 +534,18 @@ describe Spree::Store, type: :model, without_global_store: true do
end
end
- describe '#default_country_iso=' do
+ describe '#default_country_code=' do
let(:store) { build(:store) }
it 'names the country the store defaults to' do
- store.default_country_iso = 'GB'
+ store.default_country_code = 'GB'
- expect(store.default_country_iso).to eq('GB')
+ expect(store.default_country_code).to eq('GB')
expect(store.default_country.iso).to eq('GB')
end
it 'ignores a code no country has' do
- store.default_country_iso = 'ZZ'
+ store.default_country_code = 'ZZ'
expect(store.default_country).to be_nil
end
@@ -846,8 +846,8 @@ describe Spree::Store, type: :model, without_global_store: true do
let!(:zone) { create(:delivery_zone) }
before do
- zone.members.create!(member_type: 'country', country_iso: country1.iso)
- zone.members.create!(member_type: 'country', country_iso: country2.iso)
+ zone.members.create!(member_type: 'country', country_code: country1.iso)
+ zone.members.create!(member_type: 'country', country_code: country2.iso)
create(:shipping_method, delivery_zone: zone)
end
@@ -863,7 +863,7 @@ describe Spree::Store, type: :model, without_global_store: true do
let!(:zone) { create(:delivery_zone) }
before do
- zone.members.create!(member_type: 'state', country_iso: state.country_iso, state_code: state.abbr)
+ zone.members.create!(member_type: 'state', country_code: state.country_code, state_code: state.abbr)
create(:shipping_method, delivery_zone: zone)
end
@@ -878,7 +878,7 @@ describe Spree::Store, type: :model, without_global_store: true do
let!(:zone) { create(:delivery_zone) }
before do
- zone.members.create!(member_type: 'country', country_iso: country.iso)
+ zone.members.create!(member_type: 'country', country_code: country.iso)
end
it 'does not include countries from that zone' do
@@ -900,8 +900,8 @@ describe Spree::Store, type: :model, without_global_store: true do
let!(:zone2) { create(:delivery_zone) }
before do
- zone1.members.create!(member_type: 'country', country_iso: country.iso)
- zone2.members.create!(member_type: 'country', country_iso: country.iso)
+ zone1.members.create!(member_type: 'country', country_code: country.iso)
+ zone2.members.create!(member_type: 'country', country_code: country.iso)
create(:shipping_method, delivery_zone: zone1)
create(:shipping_method, delivery_zone: zone2)
end
diff --git a/spree/core/spec/models/spree/tax_exemption_certificate_spec.rb b/spree/core/spec/models/spree/tax_exemption_certificate_spec.rb
index 03d456e84f..9757af8696 100644
--- a/spree/core/spec/models/spree/tax_exemption_certificate_spec.rb
+++ b/spree/core/spec/models/spree/tax_exemption_certificate_spec.rb
@@ -56,26 +56,26 @@ describe Spree::TaxExemptionCertificate, type: :model do
end
it 'matches one naming the country' do
- certificate = create(:tax_exemption_certificate, company: company, country_iso: germany&.iso)
+ certificate = create(:tax_exemption_certificate, company: company, country_code: germany&.iso)
expect(described_class.for_address(address)).to include(certificate)
end
it 'matches one naming the exact state' do
- certificate = create(:tax_exemption_certificate, company: company, country_iso: germany&.iso, state_code: berlin&.abbr)
+ certificate = create(:tax_exemption_certificate, company: company, country_code: germany&.iso, state_code: berlin&.abbr)
expect(described_class.for_address(address)).to include(certificate)
end
it 'excludes one naming another state of the same country' do
other = create(:state, country: germany, abbr: 'HH', name: 'Hamburg')
- certificate = create(:tax_exemption_certificate, company: company, country_iso: germany&.iso, state_code: other&.abbr)
+ certificate = create(:tax_exemption_certificate, company: company, country_code: germany&.iso, state_code: other&.abbr)
expect(described_class.for_address(address)).not_to include(certificate)
end
it 'excludes one naming another country' do
- certificate = create(:tax_exemption_certificate, company: company, country_iso: create(:country, iso: 'FR')&.iso)
+ certificate = create(:tax_exemption_certificate, company: company, country_code: create(:country, iso: 'FR')&.iso)
expect(described_class.for_address(address)).not_to include(certificate)
end
@@ -87,15 +87,15 @@ describe Spree::TaxExemptionCertificate, type: :model do
# registry drift — must still narrow to nothing.
it 'never matches when the country code is one nothing recognises' do
certificate = create(:tax_exemption_certificate, company: company)
- certificate.update_columns(country_iso: 'ZZ')
+ certificate.update_columns(country_code: 'ZZ')
expect(described_class.for_address(address)).not_to include(certificate)
end
it 'stores the jurisdiction upcased however it was entered' do
- certificate = create(:tax_exemption_certificate, company: company, country_iso: 'de', state_code: 'be')
+ certificate = create(:tax_exemption_certificate, company: company, country_code: 'de', state_code: 'be')
- expect(certificate.country_iso).to eq('DE')
+ expect(certificate.country_code).to eq('DE')
expect(certificate.state_code).to eq('BE')
end
end
diff --git a/spree/core/spec/models/spree/tax_exemption_spec.rb b/spree/core/spec/models/spree/tax_exemption_spec.rb
index b5fef1757e..6f0443575e 100644
--- a/spree/core/spec/models/spree/tax_exemption_spec.rb
+++ b/spree/core/spec/models/spree/tax_exemption_spec.rb
@@ -23,7 +23,7 @@ describe Spree::TaxExemption, type: :model do
end
it 'claims a whole country without a state' do
- exemption = described_class.new(reason_code: 'resale', country_iso: 'US')
+ exemption = described_class.new(reason_code: 'resale', country_code: 'US')
expect(exemption.covers_jurisdiction?('US', 'NY')).to be(true)
expect(exemption.covers_jurisdiction?('us', nil)).to be(true)
@@ -31,7 +31,7 @@ describe Spree::TaxExemption, type: :model do
end
it 'claims one state when it names one' do
- exemption = described_class.new(reason_code: 'resale', country_iso: 'US', state_code: 'NY')
+ exemption = described_class.new(reason_code: 'resale', country_code: 'US', state_code: 'NY')
expect(exemption.covers_jurisdiction?('US', 'NY')).to be(true)
expect(exemption.covers_jurisdiction?('US', 'CA')).to be(false)
diff --git a/spree/core/spec/models/spree/tax_provider/internal_spec.rb b/spree/core/spec/models/spree/tax_provider/internal_spec.rb
index cde032e772..7006be1134 100644
--- a/spree/core/spec/models/spree/tax_provider/internal_spec.rb
+++ b/spree/core/spec/models/spree/tax_provider/internal_spec.rb
@@ -15,7 +15,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
describe '#estimate' do
context 'with an additional rate' do
- let!(:rate) { create(:tax_rate, country_iso: country&.iso, amount: 0.1, tax_category: line_item.tax_category, included_in_price: false) }
+ let!(:rate) { create(:tax_rate, country_code: country&.iso, amount: 0.1, tax_category: line_item.tax_category, included_in_price: false) }
it 'writes a tax line with snapshots' do
provider.estimate(order)
@@ -34,7 +34,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
tax_line = order.tax_lines.reload.sole
expect(tax_line.taxability_reason).to eq('standard_rated')
- expect(tax_line.country_iso).to eq(order.tax_address.country.iso)
+ expect(tax_line.country_code).to eq(order.tax_address.country.iso)
expect(tax_line.state_code).to eq(order.tax_address.state&.abbr)
end
@@ -56,7 +56,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
provider.estimate(order)
expect(order.tax_lines.reload.count).to eq(1)
- rate.update!(country_iso: 'JP')
+ rate.update!(country_code: 'JP')
provider.estimate(order)
expect(order.tax_lines.reload).to be_empty
end
@@ -71,7 +71,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
end
context 'with an included (VAT) rate' do
- let!(:rate) { create(:tax_rate, country_iso: country&.iso, amount: 0.2, tax_category: line_item.tax_category, included_in_price: true) }
+ let!(:rate) { create(:tax_rate, country_code: country&.iso, amount: 0.2, tax_category: line_item.tax_category, included_in_price: true) }
it 'backs the tax out of the gross basis' do
provider.estimate(order)
@@ -84,7 +84,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
end
context 'with a matched zero rate' do
- let!(:rate) { create(:tax_rate, country_iso: country&.iso, amount: 0, tax_category: line_item.tax_category, included_in_price: false) }
+ let!(:rate) { create(:tax_rate, country_code: country&.iso, amount: 0, tax_category: line_item.tax_category, included_in_price: false) }
it 'still writes a row, marked zero-rated' do
provider.estimate(order)
@@ -97,7 +97,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
end
context 'with no matching rate' do
- let!(:rate) { create(:tax_rate, country_iso: country&.iso, amount: 0.1, tax_category: create(:tax_category), included_in_price: false) }
+ let!(:rate) { create(:tax_rate, country_code: country&.iso, amount: 0.1, tax_category: create(:tax_category), included_in_price: false) }
it 'writes nothing, having formed no opinion' do
provider.estimate(order)
@@ -111,7 +111,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
let(:cart_line_item) { cart.line_items.first }
let(:cart_country) { cart.tax_address.country }
let!(:rate) do
- create(:tax_rate, country_iso: cart_country&.iso, amount: 0.1, tax_category: cart_line_item.tax_category, included_in_price: false)
+ create(:tax_rate, country_code: cart_country&.iso, amount: 0.1, tax_category: cart_line_item.tax_category, included_in_price: false)
end
it 'owns the row through the cart FK' do
@@ -125,7 +125,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
end
context 'with an exemption covering the sale' do
- let!(:rate) { create(:tax_rate, country_iso: country&.iso, amount: 0.1, tax_category: line_item.tax_category, included_in_price: false) }
+ let!(:rate) { create(:tax_rate, country_code: country&.iso, amount: 0.1, tax_category: line_item.tax_category, included_in_price: false) }
let(:exemption) { Spree::TaxExemption.new(reason_code: 'resale', certificate_number: 'CERT-1') }
it 'writes a zero row recording the claim' do
@@ -138,7 +138,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
end
it 'ignores an exemption scoped to another jurisdiction' do
- elsewhere = Spree::TaxExemption.new(reason_code: 'resale', country_iso: 'DE')
+ elsewhere = Spree::TaxExemption.new(reason_code: 'resale', country_code: 'DE')
provider.estimate(order, exemptions: [elsewhere])
@@ -160,7 +160,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
# The whole chain: a certificate the company holds, resolved by the real
# service, reaching the provider as a claim.
context 'with a certificate the buyer company holds' do
- let!(:rate) { create(:tax_rate, country_iso: country&.iso, amount: 0.1, tax_category: line_item.tax_category, included_in_price: false) }
+ let!(:rate) { create(:tax_rate, country_code: country&.iso, amount: 0.1, tax_category: line_item.tax_category, included_in_price: false) }
let(:company) { create(:company, store: @default_store) }
let(:location) { create(:company_location, company: company) }
@@ -173,7 +173,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
it 'exempts the sale instead of taxing it' do
create(:tax_exemption_certificate, :verified, company: company,
reason_code: 'resale', certificate_number: 'CERT-9',
- country_iso: country&.iso)
+ country_code: country&.iso)
provider.estimate(order, exemptions: resolved_exemptions)
@@ -184,7 +184,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
end
it 'taxes normally while the certificate is still awaiting verification' do
- create(:tax_exemption_certificate, company: company, country_iso: country&.iso)
+ create(:tax_exemption_certificate, company: company, country_code: country&.iso)
provider.estimate(order, exemptions: resolved_exemptions)
@@ -193,7 +193,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
end
context 'with an exemption against an included (VAT) rate' do
- let!(:rate) { create(:tax_rate, country_iso: country&.iso, amount: 0.2, tax_category: line_item.tax_category, included_in_price: true) }
+ let!(:rate) { create(:tax_rate, country_code: country&.iso, amount: 0.2, tax_category: line_item.tax_category, included_in_price: true) }
it 'leaves the whole basis pre-tax, having no tax to back out' do
provider.estimate(order, exemptions: [Spree::TaxExemption.new(reason_code: 'government')])
@@ -205,7 +205,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
context 'when another store holds the default tax category' do
let!(:rate) do
- create(:tax_rate, country_iso: country&.iso, amount: 0.1,
+ create(:tax_rate, country_code: country&.iso, amount: 0.1,
tax_category: create(:tax_category, is_default: true), included_in_price: false)
end
let!(:fee) { create(:fee, order: order, amount: 5, kind: 'surcharge', label: 'Handling') }
@@ -234,13 +234,13 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
# recalculate the order and estimate tax a second time.
fulfillment.update_columns(cost: 10)
# A store default exists, so falling back to it is a visible wrong answer.
- create(:tax_rate, country_iso: country&.iso, amount: 0.2, included_in_price: false,
+ create(:tax_rate, country_code: country&.iso, amount: 0.2, included_in_price: false,
tax_category: create(:tax_category, is_default: true))
fulfillment.reload
end
it "taxes delivery at its delivery method's category" do
- reduced_rate = create(:tax_rate, country_iso: country&.iso, amount: 0.05, included_in_price: false,
+ reduced_rate = create(:tax_rate, country_code: country&.iso, amount: 0.05, included_in_price: false,
tax_category: reduced_rate_category)
provider.estimate(order, [fulfillment])
@@ -263,7 +263,7 @@ xdescribe Spree::TaxProvider::Internal, type: :model do
context 'with a taxable fee' do
let!(:rate) do
- create(:tax_rate, country_iso: country&.iso, amount: 0.1, tax_category: create(:tax_category, is_default: true), included_in_price: false)
+ create(:tax_rate, country_code: country&.iso, amount: 0.1, tax_category: create(:tax_category, is_default: true), included_in_price: false)
end
let!(:fee) { create(:fee, order: order, amount: 5, kind: 'surcharge', label: 'Handling') }
diff --git a/spree/core/spec/models/spree/tax_rate_spec.rb b/spree/core/spec/models/spree/tax_rate_spec.rb
index e1642cfd62..d120f60bbe 100644
--- a/spree/core/spec/models/spree/tax_rate_spec.rb
+++ b/spree/core/spec/models/spree/tax_rate_spec.rb
@@ -13,7 +13,7 @@ describe Spree::TaxRate, type: :model do
it 'falls back to rates that tax everywhere when the jurisdiction is unknown' do
worldwide = create(:tax_rate, :worldwide, tax_category: tax_category)
- create(:tax_rate, country_iso: germany&.iso, tax_category: tax_category)
+ create(:tax_rate, country_code: germany&.iso, tax_category: tax_category)
# A rate naming no country taxes everywhere, so it still applies when we
# cannot say where the sale is — a country-specific one does not.
@@ -21,22 +21,22 @@ describe Spree::TaxRate, type: :model do
end
it 'reads a jurisdiction off an address, or takes the pair directly' do
- rate = create(:tax_rate, country_iso: germany&.iso, tax_category: tax_category)
+ rate = create(:tax_rate, country_code: germany&.iso, tax_category: tax_category)
expect(described_class.for_address(german_address)).to eq([rate])
expect(described_class.for_jurisdiction(germany.iso)).to eq([rate])
end
it 'matches a rate for the address country' do
- rate = create(:tax_rate, country_iso: germany&.iso, tax_category: tax_category)
- create(:tax_rate, country_iso: france&.iso, tax_category: tax_category)
+ rate = create(:tax_rate, country_code: germany&.iso, tax_category: tax_category)
+ create(:tax_rate, country_code: france&.iso, tax_category: tax_category)
expect(described_class.for_address(german_address)).to eq([rate])
end
it 'matches every rate configured for that country' do
- standard = create(:tax_rate, country_iso: germany&.iso, amount: 0.19, tax_category: tax_category)
- reduced = create(:tax_rate, country_iso: germany&.iso, amount: 0.07, tax_category: create(:tax_category))
+ standard = create(:tax_rate, country_code: germany&.iso, amount: 0.19, tax_category: tax_category)
+ reduced = create(:tax_rate, country_code: germany&.iso, amount: 0.07, tax_category: create(:tax_category))
expect(described_class.for_address(german_address)).to match_array([standard, reduced])
end
@@ -51,21 +51,21 @@ describe Spree::TaxRate, type: :model do
let(:berlin_address) { create(:address, country: germany, state: berlin) }
it 'matches the state rate alongside the country rate' do
- country_rate = create(:tax_rate, country_iso: germany&.iso, tax_category: tax_category)
- state_rate = create(:tax_rate, country_iso: germany&.iso, state_code: berlin&.abbr, tax_category: create(:tax_category))
+ country_rate = create(:tax_rate, country_code: germany&.iso, tax_category: tax_category)
+ state_rate = create(:tax_rate, country_code: germany&.iso, state_code: berlin&.abbr, tax_category: create(:tax_category))
expect(described_class.for_address(berlin_address)).to match_array([country_rate, state_rate])
end
it 'does not match another state rate' do
hamburg = create(:state, country: germany, abbr: 'HH', name: 'Hamburg')
- create(:tax_rate, country_iso: germany&.iso, state_code: hamburg&.abbr, tax_category: tax_category)
+ create(:tax_rate, country_code: germany&.iso, state_code: hamburg&.abbr, tax_category: tax_category)
expect(described_class.for_address(berlin_address)).to be_empty
end
it 'does not match a state rate for an address with no state' do
- create(:tax_rate, country_iso: germany&.iso, state_code: berlin&.abbr, tax_category: tax_category)
+ create(:tax_rate, country_code: germany&.iso, state_code: berlin&.abbr, tax_category: tax_category)
expect(described_class.for_address(german_address)).to be_empty
end
@@ -75,16 +75,16 @@ describe Spree::TaxRate, type: :model do
# registry drift — simply never matches an address, which is what the
# mismatch always meant.
it 'never matches when the state code belongs to another country' do
- rate = create(:tax_rate, country_iso: 'FR', tax_category: tax_category)
+ rate = create(:tax_rate, country_code: 'FR', tax_category: tax_category)
rate.update_columns(state_code: berlin&.abbr)
expect(described_class.for_address(german_address)).to be_empty
end
it 'matches regardless of the case a code was entered in' do
- rate = create(:tax_rate, country_iso: 'de', tax_category: tax_category)
+ rate = create(:tax_rate, country_code: 'de', tax_category: tax_category)
- expect(rate.country_iso).to eq('DE')
+ expect(rate.country_code).to eq('DE')
expect(described_class.for_address(german_address)).to eq([rate])
end
end
@@ -102,21 +102,21 @@ describe Spree::TaxRate, type: :model do
let!(:german_vat) do
create(:tax_rate, name: 'German VAT', amount: 0.19, tax_category: moss_category,
- country_iso: germany&.iso, included_in_price: true)
+ country_code: germany&.iso, included_in_price: true)
end
let!(:french_vat) do
create(:tax_rate, name: 'French VAT', amount: 0.25, tax_category: moss_category,
- country_iso: france&.iso, included_in_price: true)
+ country_code: france&.iso, included_in_price: true)
end
# Physical goods are taxed where they ship from, so both EU countries
# carry the same rate — one row each, a zone spanning both being gone.
let!(:german_goods_vat) do
create(:tax_rate, name: 'EU VAT (DE)', amount: 0.19, tax_category: normal_category,
- country_iso: germany&.iso, included_in_price: true)
+ country_code: germany&.iso, included_in_price: true)
end
let!(:french_goods_vat) do
create(:tax_rate, name: 'EU VAT (FR)', amount: 0.19, tax_category: normal_category,
- country_iso: france&.iso, included_in_price: true)
+ country_code: france&.iso, included_in_price: true)
end
let(:download) { create(:product, tax_category: moss_category, price: 100) }
@@ -205,7 +205,7 @@ describe Spree::TaxRate, type: :model do
let!(:order) { create(:order, ship_address: create(:address, country: country)) }
let(:category) { create(:tax_category, name: 'Taxable Foo') }
let!(:rate) do
- create(:tax_rate, name: 'Tax Rate #1', amount: 0.1, tax_category: category, country_iso: country&.iso)
+ create(:tax_rate, name: 'Tax Rate #1', amount: 0.1, tax_category: category, country_code: country&.iso)
end
let(:taxable) { create(:product, tax_category: category) }
let!(:line_item) { Spree::Orders::AddItem.call(order: order, variant: taxable.default_variant).value }
@@ -238,20 +238,20 @@ describe Spree::TaxRate, type: :model do
let!(:included_tax_rate) do
create(:tax_rate, included_in_price: true, tax_category: line_item.tax_category,
- country_iso: country&.iso, amount: 0.4)
+ country_code: country&.iso, amount: 0.4)
end
let!(:other_included_tax_rate) do
create(:tax_rate, included_in_price: true, tax_category: line_item.tax_category,
- country_iso: country&.iso, amount: 0.05)
+ country_code: country&.iso, amount: 0.05)
end
# Additional tax is added to the price rather than sitting inside it.
let!(:additional_tax_rate) do
create(:tax_rate, included_in_price: false, tax_category: line_item.tax_category,
- country_iso: country&.iso, amount: 0.2)
+ country_code: country&.iso, amount: 0.2)
end
let!(:included_tax_rate_from_somewhere_else) do
create(:tax_rate, included_in_price: true, tax_category: line_item.tax_category,
- country_iso: create(:country, iso: 'JP', name: 'Japan')&.iso, amount: 0.1)
+ country_code: create(:country, iso: 'JP', name: 'Japan')&.iso, amount: 0.1)
end
let(:price_options) { { country: country, tax_category: line_item.tax_category } }
diff --git a/spree/core/spec/services/spree/addresses/update_spec.rb b/spree/core/spec/services/spree/addresses/update_spec.rb
index 2f3993e5b4..f00399340f 100644
--- a/spree/core/spec/services/spree/addresses/update_spec.rb
+++ b/spree/core/spec/services/spree/addresses/update_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe Spree::Addresses::Update do
phone: FFaker::PhoneNumber.phone_number,
zipcode: Spree::TestingSupport::CountryPool.postal_code_for(country.iso),
state_name: state.name,
- country_iso: country.iso
+ country_code: country.iso
}
end
@@ -137,7 +137,7 @@ RSpec.describe Spree::Addresses::Update do
let!(:completed_order) { create(:completed_order_with_totals, customer: user, ship_address: address, bill_address: address) }
context 'when there have been created same address with new params' do
- let!(:same_address) { user.addresses.create(new_address_params.merge(country_iso: country.iso, state_code: state.abbr)) }
+ let!(:same_address) { user.addresses.create(new_address_params.merge(country_code: country.iso, state_code: state.abbr)) }
context 'when is not deleted' do
it 'takes that address' do
diff --git a/spree/core/spec/services/spree/carts/update_spec.rb b/spree/core/spec/services/spree/carts/update_spec.rb
index 90d4a6cc99..effab3aad4 100644
--- a/spree/core/spec/services/spree/carts/update_spec.rb
+++ b/spree/core/spec/services/spree/carts/update_spec.rb
@@ -273,7 +273,7 @@ module Spree
address1: '123 Main St',
city: 'New York',
postal_code: '10001',
- country_iso: 'US',
+ country_code: 'US',
state_abbr: 'NY',
phone: '555-1234'
}
@@ -334,7 +334,7 @@ module Spree
shipping_address: {
first_name: 'John', last_name: 'Doe',
address1: '123 Main St', city: 'New York',
- postal_code: '10001', country_iso: 'US', state_abbr: 'NY',
+ postal_code: '10001', country_code: 'US', state_abbr: 'NY',
phone: '555-1234'
}
}
@@ -476,7 +476,7 @@ module Spree
address1: '456 Oak Ave',
city: 'New York',
postal_code: '10002',
- country_iso: 'US',
+ country_code: 'US',
state_abbr: 'NY',
phone: '555-9999'
}
@@ -505,7 +505,7 @@ module Spree
address1: '123 Main St',
city: 'New York',
postal_code: '10001',
- country_iso: 'US',
+ country_code: 'US',
state_abbr: 'NY',
phone: '555-1234'
}
@@ -626,7 +626,7 @@ module Spree
address1: '123 Main St',
city: 'New York',
postal_code: '10001',
- country_iso: 'US',
+ country_code: 'US',
state_abbr: 'NY'
}
}
@@ -752,7 +752,7 @@ module Spree
{
first_name: 'Buyer', last_name: 'McGee',
address1: '1 Test St', city: 'New York',
- postal_code: '10001', country_iso: 'US', state_abbr: 'NY',
+ postal_code: '10001', country_code: 'US', state_abbr: 'NY',
phone: '555-0100'
}
end
@@ -830,7 +830,7 @@ module Spree
shipping_address: {
first_name: 'Buyer', last_name: 'McGee',
address1: '1 Test St', city: 'New York',
- postal_code: '10001', country_iso: 'US', state_abbr: 'NY',
+ postal_code: '10001', country_code: 'US', state_abbr: 'NY',
phone: '555-0100'
} }
end
diff --git a/spree/core/spec/services/spree/orders/create_spec.rb b/spree/core/spec/services/spree/orders/create_spec.rb
index 28062e2ad3..30e4fd119d 100644
--- a/spree/core/spec/services/spree/orders/create_spec.rb
+++ b/spree/core/spec/services/spree/orders/create_spec.rb
@@ -25,7 +25,7 @@ module Spree
firstname: 'Jane', lastname: 'Doe',
address1: '350 Fifth Avenue', city: 'New York',
zipcode: '10118', phone: '555-555-0199',
- country_iso: country.iso, state_abbr: state.abbr
+ country_code: country.iso, state_abbr: state.abbr
}
end
diff --git a/spree/core/spec/services/spree/orders/update_spec.rb b/spree/core/spec/services/spree/orders/update_spec.rb
index c40475551d..ff72a1b8f5 100644
--- a/spree/core/spec/services/spree/orders/update_spec.rb
+++ b/spree/core/spec/services/spree/orders/update_spec.rb
@@ -179,7 +179,7 @@ module Spree
address1: '99 New Street', city: 'Other City',
zipcode: Spree::TestingSupport::CountryPool.postal_code_for(other_country.iso),
phone: '555-000-9999',
- country_iso: other_country.iso, state_abbr: other_state.abbr
+ country_code: other_country.iso, state_abbr: other_state.abbr
}
end
let(:params) { { ship_address_attributes: new_address_attrs } }
@@ -190,7 +190,7 @@ module Spree
expect(subject).to be_success
order.reload
- expect(order.ship_address.country_iso).to eq(other_country.iso)
+ expect(order.ship_address.country_code).to eq(other_country.iso)
expect(order.ship_address.address1).to eq('99 New Street')
new_shipment_ids = order.shipments.map(&:id)
@@ -254,7 +254,7 @@ module Spree
address1: '99 New Street', city: 'Other City',
zipcode: Spree::TestingSupport::CountryPool.postal_code_for(other_country.iso),
phone: '555-000-9999',
- country_iso: other_country.iso, state_abbr: other_state.abbr
+ country_code: other_country.iso, state_abbr: other_state.abbr
}
})
diff --git a/spree/core/spec/services/spree/tax/resolve_exemptions_spec.rb b/spree/core/spec/services/spree/tax/resolve_exemptions_spec.rb
index fc212a21e0..7b2291cef3 100644
--- a/spree/core/spec/services/spree/tax/resolve_exemptions_spec.rb
+++ b/spree/core/spec/services/spree/tax/resolve_exemptions_spec.rb
@@ -26,13 +26,13 @@ describe Spree::Tax::ResolveExemptions do
it 'turns an active certificate into a claim' do
create(:tax_exemption_certificate, :verified, company: company,
reason_code: 'resale', certificate_number: 'DE-RESALE-1',
- country_iso: germany&.iso, state_code: berlin&.abbr)
+ country_code: germany&.iso, state_code: berlin&.abbr)
exemption = described_class.call(order: order.reload).value.sole
expect(exemption.reason_code).to eq('resale')
expect(exemption.certificate_number).to eq('DE-RESALE-1')
- expect(exemption.country_iso).to eq('DE')
+ expect(exemption.country_code).to eq('DE')
expect(exemption.state_code).to eq('BE')
end
@@ -57,7 +57,7 @@ describe Spree::Tax::ResolveExemptions do
end
it 'ignores one held for another jurisdiction' do
- create(:tax_exemption_certificate, :verified, company: company, country_iso: create(:country, iso: 'FR')&.iso)
+ create(:tax_exemption_certificate, :verified, company: company, country_code: create(:country, iso: 'FR')&.iso)
expect(described_class.call(order: order.reload).value).to eq([])
end
diff --git a/spree/core/spec/workflows/spree/carts/add_item_spec.rb b/spree/core/spec/workflows/spree/carts/add_item_spec.rb
index e05b80460f..99e8783e0f 100644
--- a/spree/core/spec/workflows/spree/carts/add_item_spec.rb
+++ b/spree/core/spec/workflows/spree/carts/add_item_spec.rb
@@ -89,7 +89,7 @@ module Spree
amount: 0.25,
included_in_price: true,
tax_category: category,
- country_iso: @default_country&.iso
+ country_code: @default_country&.iso
)
end
let(:variant) { create(:variant, price: 1000) }
diff --git a/spree/core/spec/workflows/spree/carts/complete_spec.rb b/spree/core/spec/workflows/spree/carts/complete_spec.rb
index 520b18263f..356dc1a1dc 100644
--- a/spree/core/spec/workflows/spree/carts/complete_spec.rb
+++ b/spree/core/spec/workflows/spree/carts/complete_spec.rb
@@ -115,7 +115,7 @@ module Spree
context 'when the cart carries tax rows' do
let(:tax_category) { create(:tax_category) }
let!(:rate) do
- create(:tax_rate, store: store, country_iso: ready_cart.tax_country&.iso, amount: 0.1,
+ create(:tax_rate, store: store, country_code: ready_cart.tax_country&.iso, amount: 0.1,
included_in_price: false, tax_category: tax_category)
end