@spree/docs 0.1.81 → 0.1.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/api-reference/store-api/errors.md +4 -4
  2. package/dist/api-reference/store-api/idempotency.md +2 -2
  3. package/dist/developer/cli/quickstart.md +150 -2
  4. package/dist/developer/contributing/creating-an-extension.md +2 -2
  5. package/dist/developer/contributing/developing-spree.md +168 -79
  6. package/dist/developer/core-concepts/addresses.md +11 -11
  7. package/dist/developer/core-concepts/adjustments.md +2 -2
  8. package/dist/developer/core-concepts/customers.md +2 -2
  9. package/dist/developer/core-concepts/events.md +13 -7
  10. package/dist/developer/core-concepts/markets.md +11 -11
  11. package/dist/developer/core-concepts/media.md +3 -3
  12. package/dist/developer/core-concepts/orders.md +11 -11
  13. package/dist/developer/core-concepts/pricing.md +2 -2
  14. package/dist/developer/core-concepts/products.md +12 -12
  15. package/dist/developer/core-concepts/promotions.md +2 -2
  16. package/dist/developer/core-concepts/search-filtering.md +12 -12
  17. package/dist/developer/core-concepts/shipments.md +3 -3
  18. package/dist/developer/core-concepts/slugs.md +4 -4
  19. package/dist/developer/core-concepts/stores.md +2 -2
  20. package/dist/developer/core-concepts/translations.md +2 -2
  21. package/dist/developer/core-concepts/users.md +2 -2
  22. package/dist/developer/create-spree-app/quickstart.md +9 -8
  23. package/dist/developer/customization/checkout.md +2 -2
  24. package/dist/developer/customization/decorators.md +11 -9
  25. package/dist/developer/customization/quickstart.md +2 -2
  26. package/dist/developer/deployment/environment_variables.md +2 -1
  27. package/dist/developer/sdk/store/markets.md +6 -6
  28. package/dist/developer/tutorial/extending-models.md +2 -2
  29. package/dist/developer/upgrades/5.4-to-5.5.md +84 -17
  30. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Addresses
3
- description: Addresses, countries, states, and zones how geography drives checkout, taxes, and shipping
3
+ description: How Spree models addresses, countries, states, and zones, and how geographic data drives checkout, tax calculation, and shipping rates.
4
4
  ---
5
5
 
6
6
  ## Overview
@@ -129,14 +129,14 @@ await client.carts.update(cartId, {
129
129
  ```bash cURL
130
130
  # Use a saved address
131
131
  curl -X PATCH 'https://api.mystore.com/api/v3/store/carts/cart_xxx' \
132
- -H 'Authorization: Bearer pk_xxx' \
132
+ -H 'X-Spree-API-Key: pk_xxx' \
133
133
  -H 'X-Spree-Token: order_token' \
134
134
  -H 'Content-Type: application/json' \
135
135
  -d '{ "shipping_address_id": "addr_xxx", "billing_address_id": "addr_yyy" }'
136
136
 
137
137
  # Or pass a new address inline
138
138
  curl -X PATCH 'https://api.mystore.com/api/v3/store/carts/cart_xxx' \
139
- -H 'Authorization: Bearer pk_xxx' \
139
+ -H 'X-Spree-API-Key: pk_xxx' \
140
140
  -H 'X-Spree-Token: order_token' \
141
141
  -H 'Content-Type: application/json' \
142
142
  -d '{
@@ -189,15 +189,15 @@ const germany = await client.countries.get('DE', { include: 'market' })
189
189
  ```bash cURL
190
190
  # List all countries
191
191
  curl 'https://api.mystore.com/api/v3/store/countries' \
192
- -H 'Authorization: Bearer pk_xxx'
192
+ -H 'X-Spree-API-Key: pk_xxx'
193
193
 
194
194
  # Get a country with states
195
- curl 'https://api.mystore.com/api/v3/store/countries/US?include=states' \
196
- -H 'Authorization: Bearer pk_xxx'
195
+ curl 'https://api.mystore.com/api/v3/store/countries/US?expand=states' \
196
+ -H 'X-Spree-API-Key: pk_xxx'
197
197
 
198
198
  # Get a country with its market
199
- curl 'https://api.mystore.com/api/v3/store/countries/DE?include=market' \
200
- -H 'Authorization: Bearer pk_xxx'
199
+ curl 'https://api.mystore.com/api/v3/store/countries/DE?expand=market' \
200
+ -H 'X-Spree-API-Key: pk_xxx'
201
201
  ```
202
202
 
203
203
 
@@ -207,7 +207,7 @@ Use the `states_required` and `zipcode_required` fields to build adaptive addres
207
207
 
208
208
  States (provinces, regions) belong to a country and are used for address validation and zone matching. Countries like the US, Canada, Australia, and India have predefined states — for these countries, customers must select a state from the list rather than typing a name.
209
209
 
210
- States are fetched via the country endpoint using `?include=states`:
210
+ States are fetched via the country endpoint using `?expand=states`:
211
211
 
212
212
 
213
213
  ```typescript SDK
@@ -220,8 +220,8 @@ usa.states.forEach(state => {
220
220
  ```
221
221
 
222
222
  ```bash cURL
223
- curl 'https://api.mystore.com/api/v3/store/countries/US?include=states' \
224
- -H 'Authorization: Bearer pk_xxx'
223
+ curl 'https://api.mystore.com/api/v3/store/countries/US?expand=states' \
224
+ -H 'X-Spree-API-Key: pk_xxx'
225
225
  ```
226
226
 
227
227
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Adjustments
3
- description: How taxes, promotions, and other price modifications are applied to orders
3
+ description: How Spree adjustments apply taxes, promotions, and other price modifications to orders, line items, and shipments, and how totals are recalculated.
4
4
  ---
5
5
 
6
6
  ## Overview
@@ -94,7 +94,7 @@ order.included_tax_total
94
94
 
95
95
  ```bash cURL
96
96
  curl 'https://api.mystore.com/api/v3/store/orders/or_abc123?expand=items,fulfillments' \
97
- -H 'Authorization: Bearer pk_xxx' \
97
+ -H 'X-Spree-API-Key: pk_xxx' \
98
98
  -H 'X-Spree-Token: <token>'
99
99
  ```
100
100
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Customers
3
- description: Customer accounts — registration, authentication, profiles, and guest checkout
3
+ description: How Spree models customer accounts — registration, authentication, addresses, order history, store credits, and guest checkout behavior.
4
4
  ---
5
5
 
6
6
  import { Since } from '/snippets/since.mdx';
@@ -84,7 +84,7 @@ const { token, user } = await client.auth.login({
84
84
 
85
85
  ```bash cURL
86
86
  curl -X POST 'https://api.mystore.com/api/v3/store/auth/login' \
87
- -H 'Authorization: Bearer pk_xxx' \
87
+ -H 'X-Spree-API-Key: pk_xxx' \
88
88
  -H 'Content-Type: application/json' \
89
89
  -d '{
90
90
  "email": "john@example.com",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Events
3
- description: Learn how Spree's event system works and how to subscribe to events.
3
+ description: Spree's event system publish and subscribe to lifecycle events from orders, products, and users to trigger background jobs and integrations.
4
4
  ---
5
5
 
6
6
  import { Since } from '/snippets/since.mdx';
@@ -65,7 +65,7 @@ module MyApp
65
65
 
66
66
  def handle(event)
67
67
  order_id = event.payload['id']
68
- order = Spree::Order.find_by(id: order_id)
68
+ order = Spree::Order.find_by_prefix_id(order_id)
69
69
  return unless order
70
70
 
71
71
  # Your custom logic here
@@ -75,6 +75,14 @@ module MyApp
75
75
  end
76
76
  ```
77
77
 
78
+ Then register it in an initializer — subscribers are not auto-discovered (see [Registering Subscribers](#registering-subscribers)):
79
+
80
+ ```ruby config/initializers/event_subscribers.rb
81
+ Rails.application.config.after_initialize do
82
+ Spree.subscribers << MyApp::OrderCompletedSubscriber
83
+ end
84
+ ```
85
+
78
86
  ### Subscriber DSL
79
87
 
80
88
  The `Spree::Subscriber` class provides a clean DSL for declaring subscriptions:
@@ -164,7 +172,7 @@ The payload contains serialized attributes, not the actual record. To get the re
164
172
  ```ruby
165
173
  def handle(event)
166
174
  record_id = event.payload['id']
167
- record = Spree::Order.find_by(id: record_id)
175
+ record = Spree::Order.find_by_prefix_id(record_id)
168
176
  return unless record
169
177
 
170
178
  # Work with the record
@@ -395,9 +403,7 @@ Models without a matching serializer will use a minimal fallback payload contain
395
403
 
396
404
  ## Registering Subscribers
397
405
 
398
- Subscribers in `app/subscribers/` are automatically registered during application initialization.
399
-
400
- For subscribers in other locations, add them to the `Spree.subscribers` array in an initializer:
406
+ Subscribers are not auto-discovered every subscriber must be registered explicitly, regardless of where the class lives. Add it to the `Spree.subscribers` array in an initializer:
401
407
 
402
408
  ```ruby config/initializers/event_subscribers.rb
403
409
  Rails.application.config.after_initialize do
@@ -521,7 +527,7 @@ module MyApp
521
527
  private
522
528
 
523
529
  def find_stock_item(event)
524
- Spree::StockItem.find_by(id: event.payload['id'])
530
+ Spree::StockItem.find_by_prefix_id(event.payload['id'])
525
531
  end
526
532
 
527
533
  def stock_dropped_below_threshold?(event, stock_item)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Markets
3
- description: Multi-region commerce with Markets bundle geography, currency, and locale into distinct selling regions within a single store.
3
+ description: Configure Spree Markets to bundle geography, currency, and locale into distinct selling regions and run multi-region commerce from a single store.
4
4
  ---
5
5
 
6
6
  import { Since } from '/snippets/since.mdx';
@@ -96,7 +96,7 @@ const { data: markets } = await client.markets.list()
96
96
 
97
97
  ```bash cURL
98
98
  curl 'https://api.mystore.com/api/v3/store/markets' \
99
- -H 'Authorization: Bearer pk_xxx'
99
+ -H 'X-Spree-API-Key: pk_xxx'
100
100
  ```
101
101
 
102
102
 
@@ -112,7 +112,7 @@ const market = await client.markets.resolve('DE')
112
112
 
113
113
  ```bash cURL
114
114
  curl 'https://api.mystore.com/api/v3/store/markets/resolve?country=DE' \
115
- -H 'Authorization: Bearer pk_xxx'
115
+ -H 'X-Spree-API-Key: pk_xxx'
116
116
  ```
117
117
 
118
118
 
@@ -141,11 +141,11 @@ const usa = await client.markets.countries.get('mkt_k5nR8xLq', 'US', {
141
141
  ```bash cURL
142
142
  # List countries in a market
143
143
  curl 'https://api.mystore.com/api/v3/store/markets/mkt_k5nR8xLq/countries' \
144
- -H 'Authorization: Bearer pk_xxx'
144
+ -H 'X-Spree-API-Key: pk_xxx'
145
145
 
146
146
  # Get a country with its states
147
- curl 'https://api.mystore.com/api/v3/store/markets/mkt_k5nR8xLq/countries/US?include=states' \
148
- -H 'Authorization: Bearer pk_xxx'
147
+ curl 'https://api.mystore.com/api/v3/store/markets/mkt_k5nR8xLq/countries/US?expand=states' \
148
+ -H 'X-Spree-API-Key: pk_xxx'
149
149
  ```
150
150
 
151
151
 
@@ -164,11 +164,11 @@ const germany = await client.countries.get('DE', { include: 'market' })
164
164
  ```bash cURL
165
165
  # All countries across all markets
166
166
  curl 'https://api.mystore.com/api/v3/store/countries' \
167
- -H 'Authorization: Bearer pk_xxx'
167
+ -H 'X-Spree-API-Key: pk_xxx'
168
168
 
169
169
  # Get a country with its market
170
- curl 'https://api.mystore.com/api/v3/store/countries/DE?include=market' \
171
- -H 'Authorization: Bearer pk_xxx'
170
+ curl 'https://api.mystore.com/api/v3/store/countries/DE?expand=market' \
171
+ -H 'X-Spree-API-Key: pk_xxx'
172
172
  ```
173
173
 
174
174
 
@@ -189,10 +189,10 @@ const { data: locales } = await client.locales.list()
189
189
 
190
190
  ```bash cURL
191
191
  curl 'https://api.mystore.com/api/v3/store/currencies' \
192
- -H 'Authorization: Bearer pk_xxx'
192
+ -H 'X-Spree-API-Key: pk_xxx'
193
193
 
194
194
  curl 'https://api.mystore.com/api/v3/store/locales' \
195
- -H 'Authorization: Bearer pk_xxx'
195
+ -H 'X-Spree-API-Key: pk_xxx'
196
196
  ```
197
197
 
198
198
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Media
3
3
  sidebarTitle: "Media"
4
- description: Product media (images, videos), named variants, focal points, and how media is served via the Store API
4
+ description: Manage product media in Spree — images, videos, named variants, focal points, and how media is uploaded, resized, and served via the Store API.
5
5
  ---
6
6
 
7
7
  import { Since } from '/snippets/since.mdx';
@@ -114,7 +114,7 @@ products.forEach(product => {
114
114
  ```bash cURL
115
115
  # thumbnail_url is always in the response — no ?expand needed
116
116
  curl 'https://api.mystore.com/api/v3/store/products?limit=12' \
117
- -H 'Authorization: Bearer pk_xxx'
117
+ -H 'X-Spree-API-Key: pk_xxx'
118
118
  ```
119
119
 
120
120
 
@@ -143,7 +143,7 @@ product.variants?.forEach(variant => {
143
143
 
144
144
  ```bash cURL
145
145
  curl 'https://api.mystore.com/api/v3/store/products/spree-tote?expand=media,variants' \
146
- -H 'Authorization: Bearer pk_xxx'
146
+ -H 'X-Spree-API-Key: pk_xxx'
147
147
  ```
148
148
 
149
149
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Orders
3
- description: Order lifecycle, checkout flow, line items, payments, and shipments
3
+ description: How Spree models orders — the cart-to-completion lifecycle, checkout state machine, line items, payments, shipments, and order totals.
4
4
  ---
5
5
 
6
6
  ## Overview
@@ -109,30 +109,30 @@ await client.carts.items.delete(cart.id, 'li_xxx')
109
109
  ```bash cURL
110
110
  # Create a cart
111
111
  curl -X POST 'https://api.mystore.com/api/v3/store/carts' \
112
- -H 'Authorization: Bearer pk_xxx'
112
+ -H 'X-Spree-API-Key: pk_xxx'
113
113
 
114
114
  # Get existing cart
115
115
  curl 'https://api.mystore.com/api/v3/store/carts/cart_xxx' \
116
- -H 'Authorization: Bearer pk_xxx' \
116
+ -H 'X-Spree-API-Key: pk_xxx' \
117
117
  -H 'X-Spree-Token: abc123'
118
118
 
119
119
  # Add an item
120
120
  curl -X POST 'https://api.mystore.com/api/v3/store/carts/cart_xxx/items' \
121
- -H 'Authorization: Bearer pk_xxx' \
121
+ -H 'X-Spree-API-Key: pk_xxx' \
122
122
  -H 'X-Spree-Token: abc123' \
123
123
  -H 'Content-Type: application/json' \
124
124
  -d '{ "variant_id": "var_xxx", "quantity": 2 }'
125
125
 
126
126
  # Update quantity
127
127
  curl -X PATCH 'https://api.mystore.com/api/v3/store/carts/cart_xxx/items/li_xxx' \
128
- -H 'Authorization: Bearer pk_xxx' \
128
+ -H 'X-Spree-API-Key: pk_xxx' \
129
129
  -H 'X-Spree-Token: abc123' \
130
130
  -H 'Content-Type: application/json' \
131
131
  -d '{ "quantity": 3 }'
132
132
 
133
133
  # Remove an item
134
134
  curl -X DELETE 'https://api.mystore.com/api/v3/store/carts/cart_xxx/items/li_xxx' \
135
- -H 'Authorization: Bearer pk_xxx' \
135
+ -H 'X-Spree-API-Key: pk_xxx' \
136
136
  -H 'X-Spree-Token: abc123'
137
137
  ```
138
138
 
@@ -206,7 +206,7 @@ await client.carts.complete(cartId)
206
206
  ```bash cURL
207
207
  # Set addresses
208
208
  curl -X PATCH 'https://api.mystore.com/api/v3/store/carts/cart_xxx' \
209
- -H 'Authorization: Bearer pk_xxx' \
209
+ -H 'X-Spree-API-Key: pk_xxx' \
210
210
  -H 'X-Spree-Token: abc123' \
211
211
  -H 'Content-Type: application/json' \
212
212
  -d '{
@@ -221,14 +221,14 @@ curl -X PATCH 'https://api.mystore.com/api/v3/store/carts/cart_xxx' \
221
221
 
222
222
  # Select a delivery rate
223
223
  curl -X PATCH 'https://api.mystore.com/api/v3/store/carts/cart_xxx/fulfillments/ful_xxx' \
224
- -H 'Authorization: Bearer pk_xxx' \
224
+ -H 'X-Spree-API-Key: pk_xxx' \
225
225
  -H 'X-Spree-Token: abc123' \
226
226
  -H 'Content-Type: application/json' \
227
227
  -d '{ "selected_delivery_rate_id": "rate_xxx" }'
228
228
 
229
229
  # Complete the order
230
230
  curl -X POST 'https://api.mystore.com/api/v3/store/carts/cart_xxx/complete' \
231
- -H 'Authorization: Bearer pk_xxx' \
231
+ -H 'X-Spree-API-Key: pk_xxx' \
232
232
  -H 'X-Spree-Token: abc123'
233
233
  ```
234
234
 
@@ -249,14 +249,14 @@ await client.carts.discountCodes.remove(cartId, 'SAVE20')
249
249
  ```bash cURL
250
250
  # Apply a discount code
251
251
  curl -X POST 'https://api.mystore.com/api/v3/store/carts/cart_xxx/discount_codes' \
252
- -H 'Authorization: Bearer pk_xxx' \
252
+ -H 'X-Spree-API-Key: pk_xxx' \
253
253
  -H 'X-Spree-Token: abc123' \
254
254
  -H 'Content-Type: application/json' \
255
255
  -d '{ "code": "SAVE20" }'
256
256
 
257
257
  # Remove a discount code
258
258
  curl -X DELETE 'https://api.mystore.com/api/v3/store/carts/cart_xxx/discount_codes/SAVE20' \
259
- -H 'Authorization: Bearer pk_xxx' \
259
+ -H 'X-Spree-API-Key: pk_xxx' \
260
260
  -H 'X-Spree-Token: abc123'
261
261
  ```
262
262
 
@@ -45,11 +45,11 @@ detailed.variants?.forEach(variant => {
45
45
  ```bash cURL
46
46
  # Product price is always in the response
47
47
  curl 'https://api.mystore.com/api/v3/store/products/spree-tote' \
48
- -H 'Authorization: Bearer pk_xxx'
48
+ -H 'X-Spree-API-Key: pk_xxx'
49
49
 
50
50
  # With variants
51
51
  curl 'https://api.mystore.com/api/v3/store/products/spree-tote?expand=variants' \
52
- -H 'Authorization: Bearer pk_xxx'
52
+ -H 'X-Spree-API-Key: pk_xxx'
53
53
  ```
54
54
 
55
55
 
@@ -107,15 +107,15 @@ const sorted = await client.products.list({
107
107
  ```bash cURL
108
108
  # List products
109
109
  curl 'https://api.mystore.com/api/v3/store/products?limit=12&page=1' \
110
- -H 'Authorization: Bearer pk_xxx'
110
+ -H 'X-Spree-API-Key: pk_xxx'
111
111
 
112
112
  # Filter by price and stock
113
113
  curl 'https://api.mystore.com/api/v3/store/products?q[price_gte]=10&q[price_lte]=50&q[in_stock]=true' \
114
- -H 'Authorization: Bearer pk_xxx'
114
+ -H 'X-Spree-API-Key: pk_xxx'
115
115
 
116
116
  # Search
117
117
  curl 'https://api.mystore.com/api/v3/store/products?q[search]=tote+bag' \
118
- -H 'Authorization: Bearer pk_xxx'
118
+ -H 'X-Spree-API-Key: pk_xxx'
119
119
  ```
120
120
 
121
121
 
@@ -139,7 +139,7 @@ const detailed = await client.products.get('spree-tote', {
139
139
 
140
140
  ```bash cURL
141
141
  curl 'https://api.mystore.com/api/v3/store/products/spree-tote?expand=variants,media,option_types,categories' \
142
- -H 'Authorization: Bearer pk_xxx'
142
+ -H 'X-Spree-API-Key: pk_xxx'
143
143
  ```
144
144
 
145
145
 
@@ -164,11 +164,11 @@ const categoryFilters = await client.products.filters({
164
164
 
165
165
  ```bash cURL
166
166
  curl 'https://api.mystore.com/api/v3/store/products/filters' \
167
- -H 'Authorization: Bearer pk_xxx'
167
+ -H 'X-Spree-API-Key: pk_xxx'
168
168
 
169
169
  # Scoped to a category
170
170
  curl 'https://api.mystore.com/api/v3/store/products/filters?category_id=ctg_xxx' \
171
- -H 'Authorization: Bearer pk_xxx'
171
+ -H 'X-Spree-API-Key: pk_xxx'
172
172
  ```
173
173
 
174
174
 
@@ -228,7 +228,7 @@ product.option_types?.forEach(optionType => {
228
228
 
229
229
  ```bash cURL
230
230
  curl 'https://api.mystore.com/api/v3/store/products/spree-tee?expand=option_types' \
231
- -H 'Authorization: Bearer pk_xxx'
231
+ -H 'X-Spree-API-Key: pk_xxx'
232
232
  ```
233
233
 
234
234
 
@@ -257,7 +257,7 @@ products.forEach(product => {
257
257
  ```bash cURL
258
258
  # thumbnail_url is always in the response — no ?expand needed
259
259
  curl 'https://api.mystore.com/api/v3/store/products?limit=12' \
260
- -H 'Authorization: Bearer pk_xxx'
260
+ -H 'X-Spree-API-Key: pk_xxx'
261
261
  ```
262
262
 
263
263
 
@@ -286,7 +286,7 @@ product.variants?.forEach(variant => {
286
286
 
287
287
  ```bash cURL
288
288
  curl 'https://api.mystore.com/api/v3/store/products/spree-tote?expand=media,variants' \
289
- -H 'Authorization: Bearer pk_xxx'
289
+ -H 'X-Spree-API-Key: pk_xxx'
290
290
  ```
291
291
 
292
292
 
@@ -338,15 +338,15 @@ const { data: products } = await client.categories.products.list('clothing/shirt
338
338
  ```bash cURL
339
339
  # List categories
340
340
  curl 'https://api.mystore.com/api/v3/store/categories' \
341
- -H 'Authorization: Bearer pk_xxx'
341
+ -H 'X-Spree-API-Key: pk_xxx'
342
342
 
343
343
  # Get a category by permalink
344
344
  curl 'https://api.mystore.com/api/v3/store/categories/clothing/shirts' \
345
- -H 'Authorization: Bearer pk_xxx'
345
+ -H 'X-Spree-API-Key: pk_xxx'
346
346
 
347
347
  # List products in a category
348
348
  curl 'https://api.mystore.com/api/v3/store/categories/clothing/shirts/products?limit=12' \
349
- -H 'Authorization: Bearer pk_xxx'
349
+ -H 'X-Spree-API-Key: pk_xxx'
350
350
  ```
351
351
 
352
352
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Promotions
3
- description: Learn about Spree's flexible promotion system for discounts, free shipping, and gifts.
3
+ description: Build percentage and fixed-amount discounts, free shipping, BOGO offers, and coupon codes with Spree's rule and action-based promotion system.
4
4
  ---
5
5
 
6
6
  ## Overview
@@ -292,7 +292,7 @@ await client.carts.discountCodes.remove('cart_abc123', 'SUMMER20', {
292
292
  ```bash cURL
293
293
  # Apply a coupon code
294
294
  curl -X POST 'https://api.mystore.com/api/v3/store/carts/cart_abc123/coupon_codes' \
295
- -H 'Authorization: Bearer pk_xxx' \
295
+ -H 'X-Spree-API-Key: pk_xxx' \
296
296
  -H 'X-Spree-Token: <token>' \
297
297
  -H 'Content-Type: application/json' \
298
298
  -d '{ "code": "SUMMER20" }'
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Search & Filtering
3
- description: "Search, filter, and sort products and other resources via the Store API"
3
+ description: "Use Ransack-style query parameters to search, filter, sort, and paginate products, taxons, and other resources through the Spree Store API."
4
4
  ---
5
5
 
6
6
  import { Since } from '/snippets/since.mdx';
@@ -29,7 +29,7 @@ const { data: products } = await client.products.list({
29
29
 
30
30
  ```bash cURL
31
31
  curl 'https://api.mystore.com/api/v3/store/products?q[search]=tote+bag&limit=12' \
32
- -H 'Authorization: Bearer pk_xxx'
32
+ -H 'X-Spree-API-Key: pk_xxx'
33
33
  ```
34
34
 
35
35
 
@@ -47,7 +47,7 @@ const { data: products } = await client.products.list({
47
47
 
48
48
  ```bash cURL
49
49
  curl 'https://api.mystore.com/api/v3/store/products?q[price_gte]=20&q[price_lte]=100' \
50
- -H 'Authorization: Bearer pk_xxx'
50
+ -H 'X-Spree-API-Key: pk_xxx'
51
51
  ```
52
52
 
53
53
 
@@ -62,7 +62,7 @@ const { data: products } = await client.products.list({
62
62
 
63
63
  ```bash cURL
64
64
  curl 'https://api.mystore.com/api/v3/store/products?q[in_stock]=true' \
65
- -H 'Authorization: Bearer pk_xxx'
65
+ -H 'X-Spree-API-Key: pk_xxx'
66
66
  ```
67
67
 
68
68
 
@@ -89,15 +89,15 @@ const { data: products } = await client.products.list({
89
89
  ```bash cURL
90
90
  # Products in a category
91
91
  curl 'https://api.mystore.com/api/v3/store/categories/clothing/shirts/products?limit=12' \
92
- -H 'Authorization: Bearer pk_xxx'
92
+ -H 'X-Spree-API-Key: pk_xxx'
93
93
 
94
94
  # Filter by category ID (includes descendants)
95
95
  curl 'https://api.mystore.com/api/v3/store/products?q[in_category]=ctg_xxx' \
96
- -H 'Authorization: Bearer pk_xxx'
96
+ -H 'X-Spree-API-Key: pk_xxx'
97
97
 
98
98
  # Multiple categories (OR logic)
99
99
  curl 'https://api.mystore.com/api/v3/store/products?q[in_categories][]=ctg_shirts&q[in_categories][]=ctg_pants' \
100
- -H 'Authorization: Bearer pk_xxx'
100
+ -H 'X-Spree-API-Key: pk_xxx'
101
101
  ```
102
102
 
103
103
 
@@ -112,7 +112,7 @@ const { data: products } = await client.products.list({
112
112
 
113
113
  ```bash cURL
114
114
  curl 'https://api.mystore.com/api/v3/store/products?q[tags_cont]=sale' \
115
- -H 'Authorization: Bearer pk_xxx'
115
+ -H 'X-Spree-API-Key: pk_xxx'
116
116
  ```
117
117
 
118
118
 
@@ -131,7 +131,7 @@ const sorted = await client.products.list({
131
131
 
132
132
  ```bash cURL
133
133
  curl 'https://api.mystore.com/api/v3/store/products?sort=price_low_to_high' \
134
- -H 'Authorization: Bearer pk_xxx'
134
+ -H 'X-Spree-API-Key: pk_xxx'
135
135
  ```
136
136
 
137
137
 
@@ -157,11 +157,11 @@ const categoryFilters = await client.products.filters({
157
157
  ```bash cURL
158
158
  # All filters
159
159
  curl 'https://api.mystore.com/api/v3/store/products/filters' \
160
- -H 'Authorization: Bearer pk_xxx'
160
+ -H 'X-Spree-API-Key: pk_xxx'
161
161
 
162
162
  # Scoped to a category
163
163
  curl 'https://api.mystore.com/api/v3/store/products/filters?category_id=ctg_xxx' \
164
- -H 'Authorization: Bearer pk_xxx'
164
+ -H 'X-Spree-API-Key: pk_xxx'
165
165
  ```
166
166
 
167
167
 
@@ -221,7 +221,7 @@ const { data: products, meta } = await client.products.list({
221
221
 
222
222
  ```bash cURL
223
223
  curl 'https://api.mystore.com/api/v3/store/products?page=1&limit=24' \
224
- -H 'Authorization: Bearer pk_xxx'
224
+ -H 'X-Spree-API-Key: pk_xxx'
225
225
  ```
226
226
 
227
227
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Shipments
3
- description: Shipping methods, rates, split shipments, and fulfillment
3
+ description: How Spree models shipments, shipping methods, calculators, stock locations, split shipments, and the fulfillment workflow from order to delivery.
4
4
  ---
5
5
 
6
6
  import { Since } from '/snippets/since.mdx';
@@ -111,12 +111,12 @@ await client.carts.fulfillments.update(cartId, fulfillment.id, {
111
111
  ```bash cURL
112
112
  # Get fulfillments
113
113
  curl 'https://api.mystore.com/api/v3/store/carts/cart_xxx?expand=fulfillments' \
114
- -H 'Authorization: Bearer pk_xxx' \
114
+ -H 'X-Spree-API-Key: pk_xxx' \
115
115
  -H 'X-Spree-Token: abc123'
116
116
 
117
117
  # Select a delivery rate
118
118
  curl -X PATCH 'https://api.mystore.com/api/v3/store/carts/cart_xxx/fulfillments/ful_xxx' \
119
- -H 'Authorization: Bearer pk_xxx' \
119
+ -H 'X-Spree-API-Key: pk_xxx' \
120
120
  -H 'X-Spree-Token: abc123' \
121
121
  -H 'Content-Type: application/json' \
122
122
  -d '{ "selected_delivery_rate_id": "rate_xxx" }'
@@ -22,11 +22,11 @@ const category = await client.categories.get('clothing/shirts')
22
22
  ```bash cURL
23
23
  # By slug
24
24
  curl 'https://api.mystore.com/api/v3/store/products/spree-tote' \
25
- -H 'Authorization: Bearer pk_xxx'
25
+ -H 'X-Spree-API-Key: pk_xxx'
26
26
 
27
27
  # By ID
28
28
  curl 'https://api.mystore.com/api/v3/store/products/prod_86Rf07xd4z' \
29
- -H 'Authorization: Bearer pk_xxx'
29
+ -H 'X-Spree-API-Key: pk_xxx'
30
30
  ```
31
31
 
32
32
 
@@ -89,11 +89,11 @@ const product = await client.products.get('chaussures-rouges', {
89
89
  ```bash cURL
90
90
  # English
91
91
  curl 'https://api.mystore.com/api/v3/store/products/red-shoes' \
92
- -H 'Authorization: Bearer pk_xxx'
92
+ -H 'X-Spree-API-Key: pk_xxx'
93
93
 
94
94
  # French
95
95
  curl 'https://api.mystore.com/api/v3/store/products/chaussures-rouges' \
96
- -H 'Authorization: Bearer pk_xxx' \
96
+ -H 'X-Spree-API-Key: pk_xxx' \
97
97
  -H 'X-Spree-Locale: fr'
98
98
  ```
99
99
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Stores
3
- description: The Store is Spree's top-level tenant — products, orders, channels, markets, and stock locations all belong to exactly one store.
3
+ description: The Store is Spree's top-level multi-tenant boundary learn how products, orders, channels, markets, and stock locations are scoped to a store.
4
4
  ---
5
5
 
6
6
  ## Overview
@@ -42,7 +42,7 @@ const store = await client.store.get()
42
42
 
43
43
  ```bash cURL
44
44
  curl 'https://api.mystore.com/api/v3/store/store' \
45
- -H 'Authorization: Bearer pk_xxx'
45
+ -H 'X-Spree-API-Key: pk_xxx'
46
46
  ```
47
47
 
48
48
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Translations
3
- description: Translate product content and other resources into multiple languages
3
+ description: Translate Spree products, taxons, and other store content into multiple languages using Mobility-backed translations and locale-aware APIs.
4
4
  ---
5
5
 
6
6
  ## Overview
@@ -85,7 +85,7 @@ const { data: categories } = await client.categories.list({}, {
85
85
  ```bash cURL
86
86
  # Fetch product in French
87
87
  curl 'https://api.mystore.com/api/v3/store/products/spree-tote' \
88
- -H 'Authorization: Bearer pk_xxx' \
88
+ -H 'X-Spree-API-Key: pk_xxx' \
89
89
  -H 'X-Spree-Locale: fr'
90
90
  ```
91
91
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Users
3
- description: Customers and admin users — authentication, accounts, and permissions
3
+ description: How Spree models customer and admin users — Devise authentication, account data, roles, abilities, and access permissions across stores.
4
4
  ---
5
5
 
6
6
  ## Overview
@@ -96,7 +96,7 @@ const { token, user } = await client.auth.login({
96
96
 
97
97
  ```bash cURL
98
98
  curl -X POST 'https://api.mystore.com/api/v3/store/auth/login' \
99
- -H 'Authorization: Bearer pk_xxx' \
99
+ -H 'X-Spree-API-Key: pk_xxx' \
100
100
  -H 'Content-Type: application/json' \
101
101
  -d '{
102
102
  "email": "john@example.com",