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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Replace permission sets with the catalog-backed RBAC core and API
Damian Legawiec8b34d6803791
diff --git a/docs/api-reference/admin.yaml b/docs/api-reference/admin.yamlindex f1e11adbee..02b2b48bcc 100644--- a/docs/api-reference/admin.yaml+++ b/docs/api-reference/admin.yaml@@ -92,16 +92,16 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImNlMjQwZmVhLWExZWUtNDJiNi1iOTdmLWUyN2M5ZjNmYWJhMCIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2MDUwMzgxfQ.4DmTtLBX9OgW1wlwaPZBWiqSrvNrNvNoMn5fEpMg0eg+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImI0YmQ3YjlhLTcwMjgtNDA2My1iZDU0LWVmZjY2Yzk4MDI1MSIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2MTM2MDU0fQ.6lPz4TORaiwgXqxJC-52aXVz7ha6VOX5DjR5D9pNge8user:id: adm_UkLWZg9DAJemail: [email protected]- first_name: Nga- last_name: Monahan- full_name: Nga Monahan+ first_name: Shasta+ last_name: Dickens+ full_name: Shasta Dickensselected_locale:- created_at: '2026-08-06T21:01:21.574Z'- updated_at: '2026-08-06T21:01:21.574Z'+ created_at: '2026-08-07T20:49:13.982Z'+ updated_at: '2026-08-07T20:49:13.982Z'avatar_url:roles:- id: role_UkLWZg9DAJ@@ -204,16 +204,16 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImUwMjI5YjY3LTVhYmQtNGRjMC05ZTk3LTUzYWFjNWVhMGE0NiIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2MDUwMzgxfQ.68DN22QAjv8OdG7vhMpVDb45fQAMPxmbwCvfLkBGej8+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImE3MmYyMzM4LTdhZmYtNDAyYS1iNzg1LTI5M2EyZDM5MmU1ZSIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2MTM2MDU0fQ.d_hnpYdCshcS2z5rVPZptmTcvHwDCAJK6DLB9i_9Jhguser:id: adm_UkLWZg9DAJemail: [email protected]- first_name: Margy- last_name: Lang- full_name: Margy Lang+ first_name: Donovan+ last_name: Nikolaus+ full_name: Donovan Nikolausselected_locale:- created_at: '2026-08-06T21:01:21.671Z'- updated_at: '2026-08-06T21:01:21.671Z'+ created_at: '2026-08-07T20:49:14.041Z'+ updated_at: '2026-08-07T20:49:14.041Z'avatar_url:roles:- id: role_UkLWZg9DAJ@@ -315,13 +315,13 @@ paths:example:user:id: adm_UkLWZg9DAJ- email: [email protected]- first_name: Eduardo- last_name: Gulgowski- full_name: Eduardo Gulgowski+ email: [email protected]+ first_name: Leoma+ last_name: Kertzmann+ full_name: Leoma Kertzmannselected_locale:- created_at: '2026-08-06T21:01:26.015Z'- updated_at: '2026-08-06T21:01:26.015Z'+ created_at: '2026-08-07T20:49:18.129Z'+ updated_at: '2026-08-07T20:49:18.129Z'avatar_url:roles:- id: role_UkLWZg9DAJ@@ -337,37 +337,40 @@ paths:subjects:- allhas_conditions: false- - allow: false- actions:- - cancel- subjects:- - Spree::Order- has_conditions: false- - allow: true- actions:- - cancel- subjects:- - Spree::Order- has_conditions: true- - allow: false- actions:- - destroy- subjects:- - Spree::Order- has_conditions: false- - allow: true- actions:- - destroy- subjects:- - Spree::Order- has_conditions: true- - allow: false- actions:- - update- - destroy- subjects:- - Spree::Role- has_conditions: true+ permission_keys:+ - read_orders+ - write_orders+ - read_payments+ - write_payments+ - read_fulfillments+ - write_fulfillments+ - read_refunds+ - write_refunds+ - read_gift_cards+ - write_gift_cards+ - read_store_credits+ - write_store_credits+ - read_products+ - write_products+ - read_categories+ - write_categories+ - read_collections+ - write_collections+ - read_stock+ - write_stock+ - read_promotions+ - write_promotions+ - read_customers+ - write_customers+ - read_settings+ - write_settings+ - read_webhooks+ - write_webhooks+ - read_api_keys+ - write_api_keys+ - read_staff+ - write_staff+ - read_dashboardschema:"$ref": "#/components/schemas/MeResponse"'401':@@ -427,13 +430,13 @@ paths:example:user:id: adm_UkLWZg9DAJ- email: [email protected]- first_name: Crissy- last_name: Conn- full_name: Crissy Conn+ email: [email protected]+ first_name: Erica+ last_name: Williamson+ full_name: Erica Williamsonselected_locale: de- created_at: '2026-08-06T21:01:26.048Z'- updated_at: '2026-08-06T21:01:26.058Z'+ created_at: '2026-08-07T20:49:18.165Z'+ updated_at: '2026-08-07T20:49:18.176Z'avatar_url:roles:- id: role_UkLWZg9DAJ@@ -449,37 +452,40 @@ paths:subjects:- allhas_conditions: false- - allow: false- actions:- - cancel- subjects:- - Spree::Order- has_conditions: false- - allow: true- actions:- - cancel- subjects:- - Spree::Order- has_conditions: true- - allow: false- actions:- - destroy- subjects:- - Spree::Order- has_conditions: false- - allow: true- actions:- - destroy- subjects:- - Spree::Order- has_conditions: true- - allow: false- actions:- - update- - destroy- subjects:- - Spree::Role- has_conditions: true+ permission_keys:+ - read_orders+ - write_orders+ - read_payments+ - write_payments+ - read_fulfillments+ - write_fulfillments+ - read_refunds+ - write_refunds+ - read_gift_cards+ - write_gift_cards+ - read_store_credits+ - write_store_credits+ - read_products+ - write_products+ - read_categories+ - write_categories+ - read_collections+ - write_collections+ - read_stock+ - write_stock+ - read_promotions+ - write_promotions+ - read_customers+ - write_customers+ - read_settings+ - write_settings+ - read_webhooks+ - write_webhooks+ - read_api_keys+ - write_api_keys+ - read_staff+ - write_staff+ - read_dashboardschema:"$ref": "#/components/schemas/MeResponse"requestBody:@@ -616,16 +622,16 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6Ijc1ZDYxMjk2LWY4YjktNDFkZi04MDk1LTcyY2Q2MWI3ZDhiNSIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2MDUzNjkxfQ.ZoCiy9So1phwisYJaBT7Pl5V-iyaeF8Df4s6iEw_5J8+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJhZG1pbiIsImp0aSI6ImVkYTU5Y2U4LWY4NTUtNDY5MC1iZDViLTU3NWU1ZjdlOGUxNCIsImlzcyI6InNwcmVlIiwiYXVkIjoiYWRtaW5fYXBpIiwiZXhwIjoxNzg2MTM5MzYzfQ.Q90fS3JVvOb5YUQlTWspNLkwybS-p6GnzksGkTQXIKUuser:id: adm_UkLWZg9DAJemail: [email protected]- first_name: Deanna- last_name: Koss- full_name: Deanna Koss+ first_name: Jeremy+ last_name: Fay+ full_name: Jeremy Fayselected_locale:- created_at: '2026-08-06T21:01:31.888Z'- updated_at: '2026-08-06T21:01:31.900Z'+ created_at: '2026-08-07T20:49:23.246Z'+ updated_at: '2026-08-07T20:49:23.259Z'avatar_url:roles:- id: role_UkLWZg9DAJ@@ -744,8 +750,8 @@ paths:data:- id: ao_UkLWZg9DAJorigin: https://shop.example.com- created_at: '2026-08-06T21:01:21.152Z'- updated_at: '2026-08-06T21:01:21.152Z'+ created_at: '2026-08-07T20:49:13.529Z'+ updated_at: '2026-08-07T20:49:13.529Z'meta:page: 1limit: 25@@ -829,8 +835,8 @@ paths:example:id: ao_gbHJdmfrXBorigin: https://admin.example.com- created_at: '2026-08-06T21:01:21.213Z'- updated_at: '2026-08-06T21:01:21.213Z'+ created_at: '2026-08-07T20:49:13.611Z'+ updated_at: '2026-08-07T20:49:13.611Z'schema:"$ref": "#/components/schemas/AllowedOrigin"'422':@@ -917,8 +923,8 @@ paths:example:id: ao_UkLWZg9DAJorigin: https://shop.example.com- created_at: '2026-08-06T21:01:21.242Z'- updated_at: '2026-08-06T21:01:21.242Z'+ created_at: '2026-08-07T20:49:13.690Z'+ updated_at: '2026-08-07T20:49:13.690Z'schema:"$ref": "#/components/schemas/AllowedOrigin"'404':@@ -979,8 +985,8 @@ paths:example:id: ao_UkLWZg9DAJorigin: https://www.example.com- created_at: '2026-08-06T21:01:21.289Z'- updated_at: '2026-08-06T21:01:21.309Z'+ created_at: '2026-08-07T20:49:13.739Z'+ updated_at: '2026-08-07T20:49:13.756Z'schema:"$ref": "#/components/schemas/AllowedOrigin"'422':@@ -1100,34 +1106,34 @@ paths:key_type: publishabletoken_prefix:scopes: []- created_at: '2026-08-06T21:01:21.374Z'- updated_at: '2026-08-06T21:01:21.374Z'+ created_at: '2026-08-07T20:49:13.807Z'+ updated_at: '2026-08-07T20:49:13.807Z'revoked_at:last_used_at:channel_id:- plaintext_token: pk_ik9JyAobWkkZ5gx3skJrX1sd+ plaintext_token: pk_6BvYcjPTJwyQAXKdEyGSrVE7created_by_email:- id: key_gbHJdmfrXBname: Backend integrationkey_type: secret- token_prefix: sk_yZeHGF3kc+ token_prefix: sk_fLgdntS6dscopes:- write_all- created_at: '2026-08-06T21:01:21.375Z'- updated_at: '2026-08-06T21:01:21.375Z'+ created_at: '2026-08-07T20:49:13.808Z'+ updated_at: '2026-08-07T20:49:13.808Z'revoked_at:last_used_at:channel_id:plaintext_token:created_by_email:- id: key_EfhxLZ9ck8- name: expedita+ name: rationekey_type: secret- token_prefix: sk_Dep2diQKJ+ token_prefix: sk_NQfrhhbe9scopes:- write_all- created_at: '2026-08-06T21:01:21.376Z'- updated_at: '2026-08-06T21:01:21.376Z'+ created_at: '2026-08-07T20:49:13.809Z'+ updated_at: '2026-08-07T20:49:13.809Z'revoked_at:last_used_at:channel_id:@@ -1194,16 +1200,16 @@ paths:id: key_VqXmZF31wYname: CI keykey_type: secret- token_prefix: sk_yFSn6NGDH+ token_prefix: sk_N1LesvL3cscopes:- read_orders- created_at: '2026-08-06T21:01:21.420Z'- updated_at: '2026-08-06T21:01:21.420Z'+ created_at: '2026-08-07T20:49:13.844Z'+ updated_at: '2026-08-07T20:49:13.844Z'revoked_at:last_used_at:channel_id:- plaintext_token: sk_yFSn6NGDHmJSc5y3Tfy3aLHE- created_by_email: [email protected]+ plaintext_token: sk_N1LesvL3cAbyKnG9YXABk9eT+ created_by_email: [email protected]'422':description: validation errorcontent:@@ -1292,12 +1298,12 @@ paths:key_type: publishabletoken_prefix:scopes: []- created_at: '2026-08-06T21:01:21.456Z'- updated_at: '2026-08-06T21:01:21.456Z'+ created_at: '2026-08-07T20:49:13.868Z'+ updated_at: '2026-08-07T20:49:13.868Z'revoked_at:last_used_at:channel_id:- plaintext_token: pk_6VbEZcnU9nwwD3TcH5RXStpC+ plaintext_token: pk_Lenc9AgL1KivRzku2RUYw7kucreated_by_email:patch:summary: Update an API key@@ -1351,11 +1357,11 @@ paths:id: key_gbHJdmfrXBname: Backend integration (renamed)key_type: secret- token_prefix: sk_sdJzRPYNC+ token_prefix: sk_HhFudTbk8scopes:- write_all- created_at: '2026-08-06T21:01:21.484Z'- updated_at: '2026-08-06T21:01:21.502Z'+ created_at: '2026-08-07T20:49:13.887Z'+ updated_at: '2026-08-07T20:49:13.903Z'revoked_at:last_used_at:channel_id:@@ -1452,13 +1458,13 @@ paths:application/json:example:id: key_EfhxLZ9ck8- name: mollitia+ name: temporibuskey_type: secret- token_prefix: sk_BMQWBnfUK+ token_prefix: sk_2J2UvtYWkscopes:- write_all- created_at: '2026-08-06T21:01:21.536Z'- updated_at: '2026-08-06T21:01:21.536Z'+ created_at: '2026-08-07T20:49:13.927Z'+ updated_at: '2026-08-07T20:49:13.927Z'revoked_at:last_used_at:channel_id:@@ -1516,12 +1522,12 @@ paths:id: key_gbHJdmfrXBname: Backend integrationkey_type: secret- token_prefix: sk_c57uXCz5Y+ token_prefix: sk_4RF2FQkm5scopes:- write_all- created_at: '2026-08-06T21:01:21.547Z'- updated_at: '2026-08-06T21:01:21.565Z'- revoked_at: '2026-08-06T21:01:21.565Z'+ created_at: '2026-08-07T20:49:13.957Z'+ updated_at: '2026-08-07T20:49:13.973Z'+ revoked_at: '2026-08-07T20:49:13.973Z'last_used_at:channel_id:plaintext_token:@@ -1598,8 +1604,8 @@ paths:lft: 1rgt: 2products_count: 0- created_at: '2026-08-06T21:01:21.744Z'- updated_at: '2026-08-06T21:01:21.744Z'+ created_at: '2026-08-07T20:49:14.105Z'+ updated_at: '2026-08-07T20:49:14.105Z'meta:page: 1limit: 25@@ -1673,8 +1679,8 @@ paths:lft: 2rgt: 3products_count: 0- created_at: '2026-08-06T21:01:21.809Z'- updated_at: '2026-08-06T21:01:21.816Z'+ created_at: '2026-08-07T20:49:14.154Z'+ updated_at: '2026-08-07T20:49:14.161Z'schema:"$ref": "#/components/schemas/Category"'422':@@ -1780,8 +1786,8 @@ paths:lft: 1rgt: 2products_count: 0- created_at: '2026-08-06T21:01:21.858Z'- updated_at: '2026-08-06T21:01:21.858Z'+ created_at: '2026-08-07T20:49:14.224Z'+ updated_at: '2026-08-07T20:49:14.224Z'schema:"$ref": "#/components/schemas/Category"'404':@@ -1851,8 +1857,8 @@ paths:lft: 1rgt: 2products_count: 0- created_at: '2026-08-06T21:01:21.915Z'- updated_at: '2026-08-06T21:01:21.942Z'+ created_at: '2026-08-07T20:49:14.275Z'+ updated_at: '2026-08-07T20:49:14.298Z'schema:"$ref": "#/components/schemas/Category"requestBody:@@ -1967,8 +1973,8 @@ paths:lft: 2rgt: 3products_count: 0- created_at: '2026-08-06T21:01:22.008Z'- updated_at: '2026-08-06T21:01:22.033Z'+ created_at: '2026-08-07T20:49:14.350Z'+ updated_at: '2026-08-07T20:49:14.374Z'schema:"$ref": "#/components/schemas/Category"requestBody:@@ -2080,8 +2086,8 @@ paths:application/json:example:id: prod_UkLWZg9DAJ- name: Product 19920- slug: product-19920+ name: Product 18111+ slug: product-18111meta_title:meta_description:meta_keywords:@@ -2093,14 +2099,21 @@ paths:in_stock: falsebackorderable: trueavailable: true- description: Deleniti delectus perferendis culpa necessitatibus atque- eaque. Veniam voluptates adipisci cum quaerat excepturi aliquam.- Facere animi tenetur magni quasi. Animi molestiae natus hic doloribus- quaerat ea quo. Illo ullam minima quis totam maxime voluptas esse.- description_html: Deleniti delectus perferendis culpa necessitatibus- atque eaque. Veniam voluptates adipisci cum quaerat excepturi aliquam.- Facere animi tenetur magni quasi. Animi molestiae natus hic doloribus- quaerat ea quo. Illo ullam minima quis totam maxime voluptas esse.+ description: Alias iste possimus sunt odio. Consequatur aperiam exercitationem+ consequuntur accusamus repellendus. Eligendi sunt dignissimos nihil+ quis ipsam eveniet deleniti. Iure incidunt id accusamus temporibus+ debitis ipsum occaecati. Quam debitis voluptatem magnam natus nobis+ perspiciatis. Nihil earum repudiandae consequuntur ratione ab perspiciatis.+ Eligendi exercitationem hic animi modi earum iste. Dignissimos nemo+ officiis repudiandae eveniet. Velit itaque unde quasi amet culpa+ illo ducimus sit. Enim porro dignissimos tenetur magnam deserunt+ fuga. Culpa dignissimos alias velit omnis vero. Expedita nulla velit+ natus deserunt. Qui fugit autem ducimus suscipit nisi omnis quibusdam+ itaque. Est tempora recusandae optio perferendis.+ description_html: |-+ Alias iste possimus sunt odio. Consequatur aperiam exercitationem consequuntur accusamus repellendus. Eligendi sunt dignissimos nihil quis ipsam eveniet deleniti. Iure incidunt id accusamus temporibus debitis ipsum occaecati.+ Quam debitis voluptatem magnam natus nobis perspiciatis. Nihil earum repudiandae consequuntur ratione ab perspiciatis. Eligendi exercitationem hic animi modi earum iste. Dignissimos nemo officiis repudiandae eveniet. Velit itaque unde quasi amet culpa illo ducimus sit.+ Enim porro dignissimos tenetur magnam deserunt fuga. Culpa dignissimos alias velit omnis vero. Expedita nulla velit natus deserunt. Qui fugit autem ducimus suscipit nisi omnis quibusdam itaque. Est tempora recusandae optio perferendis.default_variant_id: variant_UkLWZg9DAJthumbnail_url:tags: []@@ -2115,14 +2128,14 @@ paths:display_compare_at_amount:price_list_id:variant_id: variant_UkLWZg9DAJ- created_at: '2026-08-06T21:01:22.157Z'- updated_at: '2026-08-06T21:01:22.157Z'+ created_at: '2026-08-07T20:49:14.484Z'+ updated_at: '2026-08-07T20:49:14.484Z'original_price:status: activemetadata: {}deleted_at:- created_at: '2026-08-06T21:01:22.134Z'- updated_at: '2026-08-06T21:01:22.168Z'+ created_at: '2026-08-07T20:49:14.464Z'+ updated_at: '2026-08-07T20:49:14.493Z'product_type_id:tax_category_id: taxcat_UkLWZg9DAJschema:@@ -2292,8 +2305,8 @@ paths:preferred_order_routing_strategy:preferred_storefront_access:preferred_guest_checkout:- created_at: '2026-08-06T21:01:20.882Z'- updated_at: '2026-08-06T21:01:20.882Z'+ created_at: '2026-08-07T20:49:13.292Z'+ updated_at: '2026-08-07T20:49:13.292Z'- id: ch_gbHJdmfrXBname: Wholesalecode: wholesale@@ -2304,8 +2317,8 @@ paths:preferred_order_routing_strategy:preferred_storefront_access:preferred_guest_checkout:- created_at: '2026-08-06T21:01:22.363Z'- updated_at: '2026-08-06T21:01:22.363Z'+ created_at: '2026-08-07T20:49:14.666Z'+ updated_at: '2026-08-07T20:49:14.666Z'meta:page: 1limit: 25@@ -2390,8 +2403,8 @@ paths:preferred_order_routing_strategy:preferred_storefront_access:preferred_guest_checkout:- created_at: '2026-08-06T21:01:22.418Z'- updated_at: '2026-08-06T21:01:22.418Z'+ created_at: '2026-08-07T20:49:14.721Z'+ updated_at: '2026-08-07T20:49:14.721Z'requestBody:content:application/json:@@ -2489,8 +2502,8 @@ paths:preferred_order_routing_strategy:preferred_storefront_access:preferred_guest_checkout:- created_at: '2026-08-06T21:01:22.430Z'- updated_at: '2026-08-06T21:01:22.430Z'+ created_at: '2026-08-07T20:49:14.731Z'+ updated_at: '2026-08-07T20:49:14.731Z'patch:summary: Update a channeltags:@@ -2544,8 +2557,8 @@ paths:preferred_order_routing_strategy:preferred_storefront_access: login_requiredpreferred_guest_checkout: false- created_at: '2026-08-06T21:01:22.458Z'- updated_at: '2026-08-06T21:01:22.483Z'+ created_at: '2026-08-07T20:49:14.760Z'+ updated_at: '2026-08-07T20:49:14.781Z'requestBody:content:application/json:@@ -2827,8 +2840,8 @@ paths:- id: orule_UkLWZg9DAJposition: 1active: true- created_at: '2026-08-06T21:01:20.886Z'- updated_at: '2026-08-06T21:01:20.886Z'+ created_at: '2026-08-07T20:49:13.297Z'+ updated_at: '2026-08-07T20:49:13.297Z'type: preferred_locationchannel_id: ch_UkLWZg9DAJpreferences: {}@@ -2839,8 +2852,8 @@ paths:- id: orule_gbHJdmfrXBposition: 2active: true- created_at: '2026-08-06T21:01:20.890Z'- updated_at: '2026-08-06T21:01:20.890Z'+ created_at: '2026-08-07T20:49:13.300Z'+ updated_at: '2026-08-07T20:49:13.300Z'type: minimize_splitschannel_id: ch_UkLWZg9DAJpreferences: {}@@ -2851,8 +2864,8 @@ paths:- id: orule_EfhxLZ9ck8position: 3active: true- created_at: '2026-08-06T21:01:20.894Z'- updated_at: '2026-08-06T21:01:20.894Z'+ created_at: '2026-08-07T20:49:13.303Z'+ updated_at: '2026-08-07T20:49:13.303Z'type: default_locationchannel_id: ch_UkLWZg9DAJpreferences: {}@@ -2917,8 +2930,8 @@ paths:id: orule_VqXmZF31wYposition: 3active: true- created_at: '2026-08-06T21:01:27.098Z'- updated_at: '2026-08-06T21:01:27.098Z'+ created_at: '2026-08-07T20:49:19.032Z'+ updated_at: '2026-08-07T20:49:19.032Z'type: default_locationchannel_id: ch_UkLWZg9DAJpreferences: {}@@ -3013,8 +3026,8 @@ paths:id: orule_UkLWZg9DAJposition: 2active: false- created_at: '2026-08-06T21:01:20.886Z'- updated_at: '2026-08-06T21:01:27.150Z'+ created_at: '2026-08-07T20:49:13.297Z'+ updated_at: '2026-08-07T20:49:19.074Z'type: preferred_locationchannel_id: ch_UkLWZg9DAJpreferences: {}@@ -3202,8 +3215,8 @@ paths:searchable: falsesortable: falsefilter_key: cf_specs_fabric- created_at: '2026-08-06T21:01:23.220Z'- updated_at: '2026-08-06T21:01:23.220Z'+ created_at: '2026-08-07T20:49:15.485Z'+ updated_at: '2026-08-07T20:49:15.485Z'- id: cfdef_gbHJdmfrXBnamespace: customkey: order_notes@@ -3214,8 +3227,8 @@ paths:searchable: falsesortable: falsefilter_key: cf_custom_order_notes- created_at: '2026-08-06T21:01:23.221Z'- updated_at: '2026-08-06T21:01:23.221Z'+ created_at: '2026-08-07T20:49:15.486Z'+ updated_at: '2026-08-07T20:49:15.486Z'meta:page: 1limit: 25@@ -3284,8 +3297,8 @@ paths:searchable: falsesortable: falsefilter_key: cf_specs_origin- created_at: '2026-08-06T21:01:23.258Z'- updated_at: '2026-08-06T21:01:23.258Z'+ created_at: '2026-08-07T20:49:15.521Z'+ updated_at: '2026-08-07T20:49:15.521Z'requestBody:content:application/json:@@ -3393,8 +3406,8 @@ paths:searchable: falsesortable: falsefilter_key: cf_specs_fabric- created_at: '2026-08-06T21:01:23.262Z'- updated_at: '2026-08-06T21:01:23.262Z'+ created_at: '2026-08-07T20:49:15.525Z'+ updated_at: '2026-08-07T20:49:15.525Z'patch:summary: Update a custom field definitiontags:@@ -3454,8 +3467,8 @@ paths:searchable: falsesortable: falsefilter_key: cf_specs_fabric- created_at: '2026-08-06T21:01:23.282Z'- updated_at: '2026-08-06T21:01:23.299Z'+ created_at: '2026-08-07T20:49:15.545Z'+ updated_at: '2026-08-07T20:49:15.561Z'requestBody:content:application/json:@@ -3601,14 +3614,14 @@ paths:name: VIPsdescription: Top spenderscustomers_count: 0- created_at: '2026-08-06T21:01:23.328Z'- updated_at: '2026-08-06T21:01:23.328Z'+ created_at: '2026-08-07T20:49:15.588Z'+ updated_at: '2026-08-07T20:49:15.588Z'- id: cg_gbHJdmfrXBname: Wholesaledescription:customers_count: 0- created_at: '2026-08-06T21:01:23.329Z'- updated_at: '2026-08-06T21:01:23.329Z'+ created_at: '2026-08-07T20:49:15.597Z'+ updated_at: '2026-08-07T20:49:15.597Z'meta:page: 1limit: 25@@ -3697,8 +3710,8 @@ paths:name: Wholesale 2description: B2B accountscustomers_count: 1- created_at: '2026-08-06T21:01:23.398Z'- updated_at: '2026-08-06T21:01:23.398Z'+ created_at: '2026-08-07T20:49:15.670Z'+ updated_at: '2026-08-07T20:49:15.670Z'schema:"$ref": "#/components/schemas/CustomerGroup"'422':@@ -3807,22 +3820,22 @@ paths:name: VIPsdescription: Top spenderscustomers_count: 1- created_at: '2026-08-06T21:01:23.452Z'- updated_at: '2026-08-06T21:01:23.452Z'+ created_at: '2026-08-07T20:49:15.724Z'+ updated_at: '2026-08-07T20:49:15.724Z'customers:- id: cust_UkLWZg9DAJ- email: [email protected]- first_name: Melanie- last_name: Beer+ email: [email protected]+ first_name: Jere+ last_name: Okunevaphone:accepts_email_marketing: false- full_name: Melanie Beer+ full_name: Jere Okunevaavailable_store_credit_total: '0'display_available_store_credit_total: "$0.00"failed_attempts: 0metadata: {}- created_at: '2026-08-06T21:01:23.455Z'- updated_at: '2026-08-06T21:01:23.455Z'+ created_at: '2026-08-07T20:49:15.728Z'+ updated_at: '2026-08-07T20:49:15.728Z'tags: []internal_note_html:default_billing_address_id:@@ -3901,8 +3914,8 @@ paths:name: VIP customers (Q1)description: Top spenderscustomers_count: 0- created_at: '2026-08-06T21:01:23.534Z'- updated_at: '2026-08-06T21:01:23.551Z'+ created_at: '2026-08-07T20:49:15.781Z'+ updated_at: '2026-08-07T20:49:15.798Z'schema:"$ref": "#/components/schemas/CustomerGroup"'422':@@ -4061,8 +4074,8 @@ paths:state_name: New Yorklabel:metadata: {}- created_at: '2026-08-06T21:01:23.618Z'- updated_at: '2026-08-06T21:01:23.618Z'+ created_at: '2026-08-07T20:49:15.859Z'+ updated_at: '2026-08-07T20:49:15.859Z'customer_id: cust_UkLWZg9DAJmeta:page: 1@@ -4155,8 +4168,8 @@ paths:state_name: New Yorklabel: Officemetadata: {}- created_at: '2026-08-06T21:01:23.673Z'- updated_at: '2026-08-06T21:01:23.673Z'+ created_at: '2026-08-07T20:49:15.905Z'+ updated_at: '2026-08-07T20:49:15.905Z'customer_id: cust_UkLWZg9DAJrequestBody:content:@@ -4270,8 +4283,8 @@ paths:state_name: New Yorklabel:metadata: {}- created_at: '2026-08-06T21:01:23.684Z'- updated_at: '2026-08-06T21:01:23.708Z'+ created_at: '2026-08-07T20:49:15.915Z'+ updated_at: '2026-08-07T20:49:15.932Z'customer_id: cust_UkLWZg9DAJrequestBody:content:@@ -4410,8 +4423,8 @@ paths:customer_id: cust_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJmetadata: {}- created_at: '2026-08-06T21:01:23.777Z'- updated_at: '2026-08-06T21:01:23.777Z'+ created_at: '2026-08-07T20:49:15.983Z'+ updated_at: '2026-08-07T20:49:15.983Z'meta:page: 1limit: 25@@ -4501,8 +4514,8 @@ paths:customer_id: cust_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJmetadata: {}- created_at: '2026-08-06T21:01:23.808Z'- updated_at: '2026-08-06T21:01:23.808Z'+ created_at: '2026-08-07T20:49:16.014Z'+ updated_at: '2026-08-07T20:49:16.014Z'delete:summary: Delete a customer credit cardtags:@@ -4627,8 +4640,8 @@ paths:currency: USDmemo:metadata: {}- created_at: '2026-08-06T21:01:23.881Z'- updated_at: '2026-08-06T21:01:23.881Z'+ created_at: '2026-08-07T20:49:16.077Z'+ updated_at: '2026-08-07T20:49:16.077Z'customer_id: cust_UkLWZg9DAJcreated_by_id: adm_UkLWZg9DAJcategory_id: sccat_UkLWZg9DAJ@@ -4707,8 +4720,8 @@ paths:currency: USDmemo: Goodwillmetadata: {}- created_at: '2026-08-06T21:01:23.953Z'- updated_at: '2026-08-06T21:01:23.953Z'+ created_at: '2026-08-07T20:49:16.148Z'+ updated_at: '2026-08-07T20:49:16.148Z'customer_id: cust_UkLWZg9DAJcreated_by_id: adm_gbHJdmfrXBcategory_id: sccat_UkLWZg9DAJ@@ -4803,8 +4816,8 @@ paths:currency: USDmemo: Updatedmetadata: {}- created_at: '2026-08-06T21:01:23.973Z'- updated_at: '2026-08-06T21:01:23.993Z'+ created_at: '2026-08-07T20:49:16.169Z'+ updated_at: '2026-08-07T20:49:16.186Z'customer_id: cust_UkLWZg9DAJcreated_by_id: adm_UkLWZg9DAJcategory_id: sccat_UkLWZg9DAJ@@ -4963,8 +4976,8 @@ paths:display_available_store_credit_total: "$0.00"failed_attempts: 0metadata: {}- created_at: '2026-08-06T21:01:24.034Z'- updated_at: '2026-08-06T21:01:24.034Z'+ created_at: '2026-08-07T20:49:16.226Z'+ updated_at: '2026-08-07T20:49:16.226Z'tags: []internal_note_html:default_billing_address_id:@@ -5046,8 +5059,8 @@ paths:display_available_store_credit_total: "$0.00"failed_attempts: 0metadata: {}- created_at: '2026-08-06T21:01:24.077Z'- updated_at: '2026-08-06T21:01:24.077Z'+ created_at: '2026-08-07T20:49:16.267Z'+ updated_at: '2026-08-07T20:49:16.267Z'tags: []internal_note_html:default_billing_address_id:@@ -5161,8 +5174,8 @@ paths:display_available_store_credit_total: "$0.00"failed_attempts: 0metadata: {}- created_at: '2026-08-06T21:01:24.088Z'- updated_at: '2026-08-06T21:01:24.088Z'+ created_at: '2026-08-07T20:49:16.278Z'+ updated_at: '2026-08-07T20:49:16.278Z'tags: []internal_note_html:default_billing_address_id:@@ -5234,8 +5247,8 @@ paths:display_available_store_credit_total: "$0.00"failed_attempts: 0metadata: {}- created_at: '2026-08-06T21:01:24.113Z'- updated_at: '2026-08-06T21:01:24.129Z'+ created_at: '2026-08-07T20:49:16.302Z'+ updated_at: '2026-08-07T20:49:16.320Z'tags: []internal_note_html:default_billing_address_id:@@ -5680,10 +5693,10 @@ paths:example:data:- id: exp_UkLWZg9DAJ- number: EF950694412+ number: EF937116057format: csv- created_at: '2026-08-06T21:01:24.470Z'- updated_at: '2026-08-06T21:01:24.470Z'+ created_at: '2026-08-07T20:49:16.639Z'+ updated_at: '2026-08-07T20:49:16.639Z'type: productsuser_id: adm_UkLWZg9DAJdone: false@@ -5754,10 +5767,10 @@ paths:application/json:example:id: exp_gbHJdmfrXB- number: EF160199010+ number: EF208944152format: csv- created_at: '2026-08-06T21:01:24.505Z'- updated_at: '2026-08-06T21:01:24.505Z'+ created_at: '2026-08-07T20:49:16.675Z'+ updated_at: '2026-08-07T20:49:16.675Z'type: productsuser_id: adm_UkLWZg9DAJdone: false@@ -5854,10 +5867,10 @@ paths:application/json:example:id: exp_UkLWZg9DAJ- number: EF787600284+ number: EF472334057format: csv- created_at: '2026-08-06T21:01:24.519Z'- updated_at: '2026-08-06T21:01:24.519Z'+ created_at: '2026-08-07T20:49:16.689Z'+ updated_at: '2026-08-07T20:49:16.689Z'type: productsuser_id: adm_UkLWZg9DAJdone: false@@ -6040,7 +6053,7 @@ paths:example:data:- id: ful_UkLWZg9DAJ- number: F26834307459+ number: F65772843841tracking: U10000tracking_url:pickup_point_data:@@ -6067,8 +6080,8 @@ paths:metadata: {}adjustment_total: '0.0'pre_tax_amount: '100.0'- created_at: '2026-08-06T21:01:27.239Z'- updated_at: '2026-08-06T21:01:27.277Z'+ created_at: '2026-08-07T20:49:19.158Z'+ updated_at: '2026-08-07T20:49:19.196Z'order_id: or_UkLWZg9DAJstock_location_id: sloc_UkLWZg9DAJmeta:@@ -6138,7 +6151,7 @@ paths:application/json:example:id: ful_gbHJdmfrXB- number: F20307512161+ number: F90909367058tracking: INPOST-12345tracking_url:pickup_point_data:@@ -6157,7 +6170,7 @@ paths:display_tax_total: "$0.00"status: fulfilledfulfillment_type: shipping- fulfilled_at: '2026-08-06T21:01:27Z'+ fulfilled_at: '2026-08-07T20:49:19Z'items:- item_id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJ@@ -6165,8 +6178,8 @@ paths:metadata: {}adjustment_total: '0.0'pre_tax_amount: '0.0'- created_at: '2026-08-06T21:01:27.408Z'- updated_at: '2026-08-06T21:01:27.427Z'+ created_at: '2026-08-07T20:49:19.335Z'+ updated_at: '2026-08-07T20:49:19.354Z'order_id: or_UkLWZg9DAJstock_location_id: sloc_UkLWZg9DAJ'422':@@ -6306,7 +6319,7 @@ paths:application/json:example:id: ful_UkLWZg9DAJ- number: F61343410375+ number: F21003498771tracking: U10000tracking_url:pickup_point_data:@@ -6333,8 +6346,8 @@ paths:metadata: {}adjustment_total: '0.0'pre_tax_amount: '100.0'- created_at: '2026-08-06T21:01:27.673Z'- updated_at: '2026-08-06T21:01:27.707Z'+ created_at: '2026-08-07T20:49:19.572Z'+ updated_at: '2026-08-07T20:49:19.602Z'order_id: or_UkLWZg9DAJstock_location_id: sloc_UkLWZg9DAJpatch:@@ -6396,7 +6409,7 @@ paths:application/json:example:id: ful_UkLWZg9DAJ- number: F98658896851+ number: F30608755932tracking: 1Z999AA10123456784tracking_url: https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=1Z999AA10123456784pickup_point_data:@@ -6423,8 +6436,8 @@ paths:metadata: {}adjustment_total: '0.0'pre_tax_amount: '100.0'- created_at: '2026-08-06T21:01:27.805Z'- updated_at: '2026-08-06T21:01:27.860Z'+ created_at: '2026-08-07T20:49:19.669Z'+ updated_at: '2026-08-07T20:49:19.721Z'order_id: or_UkLWZg9DAJstock_location_id: sloc_UkLWZg9DAJrequestBody:@@ -6500,7 +6513,7 @@ paths:application/json:example:id: ful_UkLWZg9DAJ- number: F04538117371+ number: F59358327738tracking: U10000tracking_url:pickup_point_data:@@ -6519,7 +6532,7 @@ paths:display_tax_total: "$0.00"status: fulfilledfulfillment_type: shipping- fulfilled_at: '2026-08-06T21:01:27Z'+ fulfilled_at: '2026-08-07T20:49:19Z'items:- item_id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJ@@ -6527,8 +6540,8 @@ paths:metadata: {}adjustment_total: '0.0'pre_tax_amount: '100.0'- created_at: '2026-08-06T21:01:27.918Z'- updated_at: '2026-08-06T21:01:27.976Z'+ created_at: '2026-08-07T20:49:19.776Z'+ updated_at: '2026-08-07T20:49:19.839Z'order_id: or_UkLWZg9DAJstock_location_id: sloc_UkLWZg9DAJ"/api/v3/admin/orders/{order_id}/fulfillments/{id}/cancel":@@ -6590,7 +6603,7 @@ paths:application/json:example:id: ful_UkLWZg9DAJ- number: F05322802673+ number: F20773385444tracking: U10000tracking_url:pickup_point_data:@@ -6617,8 +6630,8 @@ paths:metadata: {}adjustment_total: '0.0'pre_tax_amount: '100.0'- created_at: '2026-08-06T21:01:28.054Z'- updated_at: '2026-08-06T21:01:28.118Z'+ created_at: '2026-08-07T20:49:19.897Z'+ updated_at: '2026-08-07T20:49:19.952Z'order_id: or_UkLWZg9DAJstock_location_id: sloc_UkLWZg9DAJ"/api/v3/admin/orders/{order_id}/fulfillments/{id}/resume":@@ -6680,7 +6693,7 @@ paths:application/json:example:id: ful_UkLWZg9DAJ- number: F25195337627+ number: F19986067143tracking: U10000tracking_url:pickup_point_data:@@ -6707,8 +6720,8 @@ paths:metadata: {}adjustment_total: '0.0'pre_tax_amount: '100.0'- created_at: '2026-08-06T21:01:28.193Z'- updated_at: '2026-08-06T21:01:28.262Z'+ created_at: '2026-08-07T20:49:20.021Z'+ updated_at: '2026-08-07T20:49:20.084Z'order_id: or_UkLWZg9DAJstock_location_id: sloc_UkLWZg9DAJ"/api/v3/admin/orders/{order_id}/fulfillments/{id}/split":@@ -6772,7 +6785,7 @@ paths:example:data:- id: ful_gbHJdmfrXB- number: F30476433021+ number: F41838223758tracking:tracking_url:pickup_point_data:@@ -6799,8 +6812,8 @@ paths:metadata: {}adjustment_total: '0.0'pre_tax_amount: '0.0'- created_at: '2026-08-06T21:01:28.480Z'- updated_at: '2026-08-06T21:01:28.548Z'+ created_at: '2026-08-07T20:49:20.204Z'+ updated_at: '2026-08-07T20:49:20.239Z'order_id: or_UkLWZg9DAJstock_location_id: sloc_gbHJdmfrXBrequestBody:@@ -6899,8 +6912,8 @@ paths:codes_count: 2currency: USDprefix: WELCOME- created_at: '2026-08-06T21:01:24.597Z'- updated_at: '2026-08-06T21:01:24.597Z'+ created_at: '2026-08-07T20:49:16.761Z'+ updated_at: '2026-08-07T20:49:16.761Z'amount: '50.0'expires_at:created_by_id:@@ -6984,8 +6997,8 @@ paths:codes_count: 5currency: USDprefix: NEWCAMP- created_at: '2026-08-06T21:01:24.638Z'- updated_at: '2026-08-06T21:01:24.638Z'+ created_at: '2026-08-07T20:49:16.799Z'+ updated_at: '2026-08-07T20:49:16.799Z'amount: '25.0'expires_at: '2030-12-31'created_by_id: adm_UkLWZg9DAJ@@ -7089,8 +7102,8 @@ paths:codes_count: 2currency: USDprefix: WELCOME- created_at: '2026-08-06T21:01:24.684Z'- updated_at: '2026-08-06T21:01:24.684Z'+ created_at: '2026-08-07T20:49:16.829Z'+ updated_at: '2026-08-07T20:49:16.829Z'amount: '50.0'expires_at:created_by_id:@@ -7196,7 +7209,7 @@ paths:example:data:- id: gc_UkLWZg9DAJ- code: 90FC095FC36A3FF6+ code: 2C9DF903F0FB823Dstatus: activecurrency: USDamount: '50.0'@@ -7210,12 +7223,12 @@ paths:redeemed_at:expired: falseactive: true- created_at: '2026-08-06T21:01:24.737Z'- updated_at: '2026-08-06T21:01:24.737Z'+ created_at: '2026-08-07T20:49:16.875Z'+ updated_at: '2026-08-07T20:49:16.875Z'customer_id:created_by_id:- id: gc_gbHJdmfrXB- code: D7EB7C584A1406FD+ code: 40DC58CE46FD3CDBstatus: activecurrency: USDamount: '25.0'@@ -7229,8 +7242,8 @@ paths:redeemed_at:expired: falseactive: true- created_at: '2026-08-06T21:01:24.739Z'- updated_at: '2026-08-06T21:01:24.739Z'+ created_at: '2026-08-07T20:49:16.876Z'+ updated_at: '2026-08-07T20:49:16.876Z'customer_id:created_by_id:meta:@@ -7318,7 +7331,7 @@ paths:application/json:example:id: gc_EfhxLZ9ck8- code: FE9A73C7BD82A4B4+ code: EB7B0331188FFEEEstatus: activecurrency: USDamount: '25.0'@@ -7332,8 +7345,8 @@ paths:redeemed_at:expired: falseactive: true- created_at: '2026-08-06T21:01:24.799Z'- updated_at: '2026-08-06T21:01:24.799Z'+ created_at: '2026-08-07T20:49:16.923Z'+ updated_at: '2026-08-07T20:49:16.923Z'customer_id:created_by_id: adm_UkLWZg9DAJschema:@@ -7442,7 +7455,7 @@ paths:application/json:example:id: gc_UkLWZg9DAJ- code: E8DB0493B3E31CEB+ code: 35BCFEE6CD8486D5status: activecurrency: USDamount: '50.0'@@ -7456,8 +7469,8 @@ paths:redeemed_at:expired: falseactive: true- created_at: '2026-08-06T21:01:24.833Z'- updated_at: '2026-08-06T21:01:24.833Z'+ created_at: '2026-08-07T20:49:16.950Z'+ updated_at: '2026-08-07T20:49:16.950Z'customer_id:created_by_id:schema:@@ -7520,7 +7533,7 @@ paths:application/json:example:id: gc_UkLWZg9DAJ- code: 6A77A37AD193C298+ code: C965C839F8E9166Cstatus: activecurrency: USDamount: '75.0'@@ -7534,8 +7547,8 @@ paths:redeemed_at:expired: falseactive: true- created_at: '2026-08-06T21:01:24.879Z'- updated_at: '2026-08-06T21:01:24.896Z'+ created_at: '2026-08-07T20:49:16.992Z'+ updated_at: '2026-08-07T20:49:17.018Z'customer_id:created_by_id:schema:@@ -7638,10 +7651,10 @@ paths:example:data:- id: imp_UkLWZg9DAJ- number: IM778887403+ number: IM852581680rows_count: 0- created_at: '2026-08-06T21:01:24.980Z'- updated_at: '2026-08-06T21:01:24.988Z'+ created_at: '2026-08-07T20:49:17.090Z'+ updated_at: '2026-08-07T20:49:17.096Z'type: productsstatus: pendingowner_type: store@@ -7817,10 +7830,10 @@ paths:application/json:example:id: imp_gbHJdmfrXB- number: IM381682191+ number: IM005586301rows_count: 0- created_at: '2026-08-06T21:01:25.039Z'- updated_at: '2026-08-06T21:01:25.078Z'+ created_at: '2026-08-07T20:49:17.142Z'+ updated_at: '2026-08-07T20:49:17.178Z'type: productsstatus: mappingowner_type: store@@ -8255,10 +8268,10 @@ paths:application/json:example:id: imp_UkLWZg9DAJ- number: IM273493166+ number: IM896009577rows_count: 0- created_at: '2026-08-06T21:01:25.210Z'- updated_at: '2026-08-06T21:01:25.216Z'+ created_at: '2026-08-07T20:49:17.303Z'+ updated_at: '2026-08-07T20:49:17.310Z'type: productsstatus: pendingowner_type: store@@ -8492,10 +8505,10 @@ paths:application/json:example:id: imp_gbHJdmfrXB- number: IM327476243+ number: IM525523963rows_count: 0- created_at: '2026-08-06T21:01:25.308Z'- updated_at: '2026-08-06T21:01:25.379Z'+ created_at: '2026-08-07T20:49:17.401Z'+ updated_at: '2026-08-07T20:49:17.463Z'type: productsstatus: completed_mappingowner_type: store@@ -8828,10 +8841,10 @@ paths:application/json:example:id: imp_gbHJdmfrXB- number: IM187464986+ number: IM136198422rows_count: 1- created_at: '2026-08-06T21:01:25.439Z'- updated_at: '2026-08-06T21:01:25.478Z'+ created_at: '2026-08-07T20:49:17.493Z'+ updated_at: '2026-08-07T20:49:17.540Z'type: productsstatus: processingowner_type: store@@ -9004,8 +9017,8 @@ paths:row_number: 2status: failedvalidation_errors: boom- created_at: '2026-08-06T21:01:25.522Z'- updated_at: '2026-08-06T21:01:25.522Z'+ created_at: '2026-08-07T20:49:17.572Z'+ updated_at: '2026-08-07T20:49:17.572Z'import_id: imp_UkLWZg9DAJitem_type:item_id:@@ -9107,8 +9120,8 @@ paths:- USsupported_locales:- en- created_at: '2026-08-06T21:01:20.876Z'- updated_at: '2026-08-06T21:01:20.876Z'+ created_at: '2026-08-07T20:49:13.286Z'+ updated_at: '2026-08-07T20:49:13.286Z'- id: mkt_gbHJdmfrXBname: EUcurrency: USD@@ -9119,8 +9132,8 @@ paths:- DEsupported_locales:- en- created_at: '2026-08-06T21:01:25.698Z'- updated_at: '2026-08-06T21:01:25.698Z'+ created_at: '2026-08-07T20:49:17.725Z'+ updated_at: '2026-08-07T20:49:17.725Z'meta:page: 1limit: 25@@ -9213,8 +9226,8 @@ paths:supported_locales:- en- fr- created_at: '2026-08-06T21:01:25.751Z'- updated_at: '2026-08-06T21:01:25.751Z'+ created_at: '2026-08-07T20:49:17.776Z'+ updated_at: '2026-08-07T20:49:17.776Z'schema:"$ref": "#/components/schemas/Market"'422':@@ -9350,8 +9363,8 @@ paths:- DEsupported_locales:- en- created_at: '2026-08-06T21:01:25.802Z'- updated_at: '2026-08-06T21:01:25.802Z'+ created_at: '2026-08-07T20:49:17.830Z'+ updated_at: '2026-08-07T20:49:17.830Z'schema:"$ref": "#/components/schemas/Market"'404':@@ -9430,8 +9443,8 @@ paths:- DEsupported_locales:- en- created_at: '2026-08-06T21:01:25.878Z'- updated_at: '2026-08-06T21:01:25.899Z'+ created_at: '2026-08-07T20:49:17.936Z'+ updated_at: '2026-08-07T20:49:17.967Z'schema:"$ref": "#/components/schemas/Market"'422':@@ -9611,8 +9624,8 @@ paths:kind: dropdownmetadata: {}filterable: true- created_at: '2026-08-06T21:01:26.074Z'- updated_at: '2026-08-06T21:01:26.074Z'+ created_at: '2026-08-07T20:49:18.192Z'+ updated_at: '2026-08-07T20:49:18.192Z'meta:page: 1limit: 25@@ -9706,8 +9719,8 @@ paths:kind: dropdownmetadata: {}filterable: true- created_at: '2026-08-06T21:01:26.139Z'- updated_at: '2026-08-06T21:01:26.139Z'+ created_at: '2026-08-07T20:49:18.248Z'+ updated_at: '2026-08-07T20:49:18.248Z'schema:"$ref": "#/components/schemas/OptionType"'422':@@ -9831,8 +9844,8 @@ paths:kind: dropdownmetadata: {}filterable: true- created_at: '2026-08-06T21:01:26.168Z'- updated_at: '2026-08-06T21:01:26.168Z'+ created_at: '2026-08-07T20:49:18.274Z'+ updated_at: '2026-08-07T20:49:18.274Z'schema:"$ref": "#/components/schemas/OptionType"'404':@@ -9905,8 +9918,8 @@ paths:kind: dropdownmetadata: {}filterable: true- created_at: '2026-08-06T21:01:26.217Z'- updated_at: '2026-08-06T21:01:26.234Z'+ created_at: '2026-08-07T20:49:18.312Z'+ updated_at: '2026-08-07T20:49:18.328Z'schema:"$ref": "#/components/schemas/OptionType"'422':@@ -10066,8 +10079,8 @@ paths:display_amount: "$1.50"provider_id: internalmetadata: {}- created_at: '2026-08-06T21:01:26.422Z'- updated_at: '2026-08-06T21:01:26.422Z'+ created_at: '2026-08-07T20:49:18.498Z'+ updated_at: '2026-08-07T20:49:18.498Z'meta:page: 1limit: 25@@ -10141,8 +10154,8 @@ paths:amount: "-2.0"display_amount: "-$2.00"metadata: {}- created_at: '2026-08-06T21:01:26.604Z'- updated_at: '2026-08-06T21:01:26.604Z'+ created_at: '2026-08-07T20:49:18.586Z'+ updated_at: '2026-08-07T20:49:18.586Z'meta:page: 1limit: 25@@ -10222,8 +10235,8 @@ paths:amount: "-3.0"display_amount: "-$3.00"metadata: {}- created_at: '2026-08-06T21:01:26.761Z'- updated_at: '2026-08-06T21:01:26.761Z'+ created_at: '2026-08-07T20:49:18.699Z'+ updated_at: '2026-08-07T20:49:18.699Z''422':description: invalid discountcontent:@@ -10320,8 +10333,8 @@ paths:amount: '4.0'display_amount: "$4.00"metadata: {}- created_at: '2026-08-06T21:01:26.961Z'- updated_at: '2026-08-06T21:01:26.961Z'+ created_at: '2026-08-07T20:49:18.880Z'+ updated_at: '2026-08-07T20:49:18.880Z''422':description: invalid feecontent:@@ -10418,7 +10431,7 @@ paths:application/json:example:id: gc_UkLWZg9DAJ- code: EE7F4D2A44C3BF9D+ code: FBAF6CFDCDBD540Fstatus: activecurrency: USDamount: '10.0'@@ -10432,8 +10445,8 @@ paths:redeemed_at:expired: falseactive: true- created_at: '2026-08-06T21:01:28.637Z'- updated_at: '2026-08-06T21:01:28.670Z'+ created_at: '2026-08-07T20:49:20.312Z'+ updated_at: '2026-08-07T20:49:20.343Z'customer_id:created_by_id:requestBody:@@ -10574,8 +10587,8 @@ paths:preorder_ships_at:quantity: 2currency: USD- name: Product 27316- slug: product-27316+ name: Product 276778+ slug: product-276778options_text: 'Size: S'price: '10.0'display_price: "$10.00"@@ -10607,12 +10620,12 @@ paths:option_type_label: Sizeimage_url:metadata: {}- created_at: '2026-08-06T21:01:28.830Z'- updated_at: '2026-08-06T21:01:28.830Z'+ created_at: '2026-08-07T20:49:20.492Z'+ updated_at: '2026-08-07T20:49:20.492Z'digital_links: []metadata: {}- created_at: '2026-08-06T21:01:28.852Z'- updated_at: '2026-08-06T21:01:28.852Z'+ created_at: '2026-08-07T20:49:20.513Z'+ updated_at: '2026-08-07T20:49:20.513Z'cost_price: '17.0'tax_category_id: taxcat_UkLWZg9DAJmeta:@@ -10684,8 +10697,8 @@ paths:preorder_ships_at:quantity: 3currency: USD- name: Product 291477- slug: product-291477+ name: Product 299400+ slug: product-299400options_text: 'Size: S'price: '19.99'display_price: "$19.99"@@ -10717,12 +10730,12 @@ paths:option_type_label: Sizeimage_url:metadata: {}- created_at: '2026-08-06T21:01:28.989Z'- updated_at: '2026-08-06T21:01:28.989Z'+ created_at: '2026-08-07T20:49:20.628Z'+ updated_at: '2026-08-07T20:49:20.628Z'digital_links: []metadata: {}- created_at: '2026-08-06T21:01:29.019Z'- updated_at: '2026-08-06T21:01:29.019Z'+ created_at: '2026-08-07T20:49:20.649Z'+ updated_at: '2026-08-07T20:49:20.649Z'cost_price: '17.0'tax_category_id: taxcat_UkLWZg9DAJrequestBody:@@ -10816,8 +10829,8 @@ paths:preorder_ships_at:quantity: 2currency: USD- name: Product 307307- slug: product-307307+ name: Product 307878+ slug: product-307878options_text: 'Size: S'price: '10.0'display_price: "$10.00"@@ -10849,12 +10862,12 @@ paths:option_type_label: Sizeimage_url:metadata: {}- created_at: '2026-08-06T21:01:29.101Z'- updated_at: '2026-08-06T21:01:29.101Z'+ created_at: '2026-08-07T20:49:20.718Z'+ updated_at: '2026-08-07T20:49:20.718Z'digital_links: []metadata: {}- created_at: '2026-08-06T21:01:29.121Z'- updated_at: '2026-08-06T21:01:29.121Z'+ created_at: '2026-08-07T20:49:20.738Z'+ updated_at: '2026-08-07T20:49:20.738Z'cost_price: '17.0'tax_category_id: taxcat_UkLWZg9DAJpatch:@@ -10921,8 +10934,8 @@ paths:preorder_ships_at:quantity: 5currency: USD- name: Product 311767- slug: product-311767+ name: Product 316614+ slug: product-316614options_text: 'Size: S'price: '19.99'display_price: "$19.99"@@ -10954,12 +10967,12 @@ paths:option_type_label: Sizeimage_url:metadata: {}- created_at: '2026-08-06T21:01:29.185Z'- updated_at: '2026-08-06T21:01:29.185Z'+ created_at: '2026-08-07T20:49:20.796Z'+ updated_at: '2026-08-07T20:49:20.796Z'digital_links: []metadata: {}- created_at: '2026-08-06T21:01:29.207Z'- updated_at: '2026-08-06T21:01:29.242Z'+ created_at: '2026-08-07T20:49:20.828Z'+ updated_at: '2026-08-07T20:49:20.869Z'cost_price: '17.0'tax_category_id: taxcat_UkLWZg9DAJrequestBody:@@ -11080,8 +11093,8 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R547198037- email: [email protected]+ number: R362870429+ email: [email protected]customer_note:currency: USDlocale: en@@ -11125,8 +11138,8 @@ paths:- USsupported_locales:- en- created_at: '2026-08-06T21:01:20.876Z'- updated_at: '2026-08-06T21:01:20.876Z'+ created_at: '2026-08-07T20:49:13.286Z'+ updated_at: '2026-08-07T20:49:13.286Z'status: draftlast_ip_address:considered_risky: false@@ -11137,8 +11150,8 @@ paths:metadata: {}canceled_at:approved_at:- created_at: '2026-08-06T21:01:30.412Z'- updated_at: '2026-08-06T21:01:30.464Z'+ created_at: '2026-08-07T20:49:22.001Z'+ updated_at: '2026-08-07T20:49:22.046Z'preferred_stock_location_id:tags: []internal_note:@@ -11316,8 +11329,8 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R295855189- email: [email protected]+ number: R976344360+ email: [email protected]customer_note:currency: USDlocale: en@@ -11361,8 +11374,8 @@ paths:- USsupported_locales:- en- created_at: '2026-08-06T21:01:20.876Z'- updated_at: '2026-08-06T21:01:20.876Z'+ created_at: '2026-08-07T20:49:13.286Z'+ updated_at: '2026-08-07T20:49:13.286Z'status: draftlast_ip_address:considered_risky: false@@ -11373,8 +11386,8 @@ paths:metadata: {}canceled_at:approved_at:- created_at: '2026-08-06T21:01:30.653Z'- updated_at: '2026-08-06T21:01:30.653Z'+ created_at: '2026-08-07T20:49:22.198Z'+ updated_at: '2026-08-07T20:49:22.198Z'preferred_stock_location_id:tags: []internal_note:@@ -11526,7 +11539,7 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R301536212+ number: R004934905email: [email protected]customer_note:currency: USD@@ -11571,8 +11584,8 @@ paths:- USsupported_locales:- en- created_at: '2026-08-06T21:01:20.876Z'- updated_at: '2026-08-06T21:01:20.876Z'+ created_at: '2026-08-07T20:49:13.286Z'+ updated_at: '2026-08-07T20:49:13.286Z'status: draftlast_ip_address:considered_risky: false@@ -11583,8 +11596,8 @@ paths:metadata: {}canceled_at:approved_at:- created_at: '2026-08-06T21:01:30.794Z'- updated_at: '2026-08-06T21:01:30.799Z'+ created_at: '2026-08-07T20:49:22.320Z'+ updated_at: '2026-08-07T20:49:22.323Z'preferred_stock_location_id: sloc_UkLWZg9DAJtags: []internal_note:@@ -11772,8 +11785,8 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R047829015- email: [email protected]+ number: R622308532+ email: [email protected]customer_note:currency: USDlocale: en@@ -11817,8 +11830,8 @@ paths:- USsupported_locales:- en- created_at: '2026-08-06T21:01:20.876Z'- updated_at: '2026-08-06T21:01:20.876Z'+ created_at: '2026-08-07T20:49:13.286Z'+ updated_at: '2026-08-07T20:49:13.286Z'status: draftlast_ip_address:considered_risky: false@@ -11829,8 +11842,8 @@ paths:metadata: {}canceled_at:approved_at:- created_at: '2026-08-06T21:01:30.824Z'- updated_at: '2026-08-06T21:01:30.824Z'+ created_at: '2026-08-07T20:49:22.340Z'+ updated_at: '2026-08-07T20:49:22.340Z'preferred_stock_location_id:tags: []internal_note:@@ -11906,7 +11919,7 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R756325863+ number: R346786184email: [email protected]customer_note:currency: USD@@ -11951,8 +11964,8 @@ paths:- USsupported_locales:- en- created_at: '2026-08-06T21:01:20.876Z'- updated_at: '2026-08-06T21:01:20.876Z'+ created_at: '2026-08-07T20:49:13.286Z'+ updated_at: '2026-08-07T20:49:13.286Z'status: draftlast_ip_address:considered_risky: false@@ -11963,8 +11976,8 @@ paths:metadata: {}canceled_at:approved_at:- created_at: '2026-08-06T21:01:30.932Z'- updated_at: '2026-08-06T21:01:30.958Z'+ created_at: '2026-08-07T20:49:22.412Z'+ updated_at: '2026-08-07T20:49:22.436Z'preferred_stock_location_id:tags: []internal_note:@@ -12152,8 +12165,8 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R839141178- email: [email protected]+ number: R078021574+ email: [email protected]customer_note:currency: USDlocale: en@@ -12161,7 +12174,7 @@ paths:coupon_code:fulfillment_status: readypayment_status: paid- completed_at: '2026-08-06T21:01:31.115Z'+ completed_at: '2026-08-07T20:49:22.548Z'item_total: '10.0'display_item_total: "$10.00"adjustment_total: '0.0'@@ -12197,8 +12210,8 @@ paths:- USsupported_locales:- en- created_at: '2026-08-06T21:01:20.876Z'- updated_at: '2026-08-06T21:01:20.876Z'+ created_at: '2026-08-07T20:49:13.286Z'+ updated_at: '2026-08-07T20:49:13.286Z'status: placedlast_ip_address:considered_risky: false@@ -12209,8 +12222,8 @@ paths:metadata: {}canceled_at:approved_at:- created_at: '2026-08-06T21:01:31.034Z'- updated_at: '2026-08-06T21:01:31.151Z'+ created_at: '2026-08-07T20:49:22.501Z'+ updated_at: '2026-08-07T20:49:22.565Z'preferred_stock_location_id:tags: []internal_note:@@ -12295,8 +12308,8 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R274620310- email: [email protected]+ number: R152801422+ email: [email protected]customer_note:currency: USDlocale: en@@ -12304,7 +12317,7 @@ paths:coupon_code:fulfillment_status: canceledpayment_status: none- completed_at: '2026-08-06T21:01:31.415Z'+ completed_at: '2026-08-07T20:49:22.761Z'item_total: '10.0'display_item_total: "$10.00"adjustment_total: '0.0'@@ -12340,8 +12353,8 @@ paths:- USsupported_locales:- en- created_at: '2026-08-06T21:01:20.876Z'- updated_at: '2026-08-06T21:01:20.876Z'+ created_at: '2026-08-07T20:49:13.286Z'+ updated_at: '2026-08-07T20:49:13.286Z'status: canceledlast_ip_address:considered_risky: false@@ -12350,10 +12363,10 @@ paths:payment_total: '0.0'display_payment_total: "$0.00"metadata: {}- canceled_at: '2026-08-06T21:01:31.440Z'+ canceled_at: '2026-08-07T20:49:22.816Z'approved_at:- created_at: '2026-08-06T21:01:31.350Z'- updated_at: '2026-08-06T21:01:31.459Z'+ created_at: '2026-08-07T20:49:22.691Z'+ updated_at: '2026-08-07T20:49:22.854Z'preferred_stock_location_id:tags: []internal_note:@@ -12416,8 +12429,8 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R545230903- email: [email protected]+ number: R202048662+ email: [email protected]customer_note:currency: USDlocale: en@@ -12425,7 +12438,7 @@ paths:coupon_code:fulfillment_status:payment_status:- completed_at: '2026-08-06T21:01:31.554Z'+ completed_at: '2026-08-07T20:49:22.965Z'item_total: '10.0'display_item_total: "$10.00"adjustment_total: '0.0'@@ -12461,8 +12474,8 @@ paths:- USsupported_locales:- en- created_at: '2026-08-06T21:01:20.876Z'- updated_at: '2026-08-06T21:01:20.876Z'+ created_at: '2026-08-07T20:49:13.286Z'+ updated_at: '2026-08-07T20:49:13.286Z'status: placedlast_ip_address:considered_risky: false@@ -12472,9 +12485,9 @@ paths:display_payment_total: "$0.00"metadata: {}canceled_at:- approved_at: '2026-08-06T21:01:31.580Z'- created_at: '2026-08-06T21:01:31.502Z'- updated_at: '2026-08-06T21:01:31.554Z'+ approved_at: '2026-08-07T20:49:22.988Z'+ created_at: '2026-08-07T20:49:22.918Z'+ updated_at: '2026-08-07T20:49:22.965Z'preferred_stock_location_id:tags: []internal_note:@@ -12537,8 +12550,8 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R800937868- email: [email protected]+ number: R543373514+ email: [email protected]customer_note:currency: USDlocale: en@@ -12546,7 +12559,7 @@ paths:coupon_code:fulfillment_status: pendingpayment_status: none- completed_at: '2026-08-06T21:01:31.663Z'+ completed_at: '2026-08-07T20:49:23.061Z'item_total: '10.0'display_item_total: "$10.00"adjustment_total: '0.0'@@ -12582,8 +12595,8 @@ paths:- USsupported_locales:- en- created_at: '2026-08-06T21:01:20.876Z'- updated_at: '2026-08-06T21:01:20.876Z'+ created_at: '2026-08-07T20:49:13.286Z'+ updated_at: '2026-08-07T20:49:13.286Z'status: placedlast_ip_address:considered_risky: false@@ -12592,10 +12605,10 @@ paths:payment_total: '0.0'display_payment_total: "$0.00"metadata: {}- canceled_at: '2026-08-06T21:01:31.691Z'+ canceled_at: '2026-08-07T20:49:23.077Z'approved_at:- created_at: '2026-08-06T21:01:31.610Z'- updated_at: '2026-08-06T21:01:31.746Z'+ created_at: '2026-08-07T20:49:23.013Z'+ updated_at: '2026-08-07T20:49:23.117Z'preferred_stock_location_id:tags: []internal_note:@@ -12658,8 +12671,8 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R769157192- email: [email protected]+ number: R242916284+ email: [email protected]customer_note:currency: USDlocale: en@@ -12667,7 +12680,7 @@ paths:coupon_code:fulfillment_status:payment_status:- completed_at: '2026-08-06T21:01:31.829Z'+ completed_at: '2026-08-07T20:49:23.190Z'item_total: '10.0'display_item_total: "$10.00"adjustment_total: '0.0'@@ -12703,8 +12716,8 @@ paths:- USsupported_locales:- en- created_at: '2026-08-06T21:01:20.876Z'- updated_at: '2026-08-06T21:01:20.876Z'+ created_at: '2026-08-07T20:49:13.286Z'+ updated_at: '2026-08-07T20:49:13.286Z'status: placedlast_ip_address:considered_risky: false@@ -12715,8 +12728,8 @@ paths:metadata: {}canceled_at:approved_at:- created_at: '2026-08-06T21:01:31.774Z'- updated_at: '2026-08-06T21:01:31.828Z'+ created_at: '2026-08-07T20:49:23.138Z'+ updated_at: '2026-08-07T20:49:23.190Z'preferred_stock_location_id:tags: []internal_note:@@ -12794,8 +12807,8 @@ paths:auto_capture:storefront_visible: trueposition: 1- created_at: '2026-08-06T21:01:31.934Z'- updated_at: '2026-08-06T21:01:31.934Z'+ created_at: '2026-08-07T20:49:23.295Z'+ updated_at: '2026-08-07T20:49:23.295Z'preferences: {}preference_schema: []meta:@@ -12941,8 +12954,8 @@ paths:auto_capture:storefront_visible: trueposition: 1- created_at: '2026-08-06T21:01:31.982Z'- updated_at: '2026-08-06T21:01:31.982Z'+ created_at: '2026-08-07T20:49:23.343Z'+ updated_at: '2026-08-07T20:49:23.343Z'preferences: {}preference_schema: []"/api/v3/admin/orders/{order_id}/payments":@@ -13013,8 +13026,8 @@ paths:data:- id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJ- response_code: BGS-f9d74c86d7af- number: PABL5U6O+ response_code: BGS-df069ea9d904+ number: PM4UZOOJamount: '110.0'display_amount: "$110.00"status: completed@@ -13032,14 +13045,14 @@ paths:customer_id:payment_method_id: pm_gbHJdmfrXBmetadata: {}- created_at: '2026-08-06T21:01:29.421Z'- updated_at: '2026-08-06T21:01:29.423Z'+ created_at: '2026-08-07T20:49:21.056Z'+ updated_at: '2026-08-07T20:49:21.059Z'metadata: {}avs_response:cvv_response_code:cvv_response_message:- created_at: '2026-08-06T21:01:29.422Z'- updated_at: '2026-08-06T21:01:29.422Z'+ created_at: '2026-08-07T20:49:21.058Z'+ updated_at: '2026-08-07T20:49:21.058Z'captured_amount: '0.0'order_id: or_UkLWZg9DAJmeta:@@ -13109,7 +13122,7 @@ paths:id: py_gbHJdmfrXBpayment_method_id: pm_EfhxLZ9ck8response_code:- number: PAL6PR3J+ number: PUEXL4JPamount: '110.0'display_amount: "$110.00"status: checkout@@ -13120,8 +13133,8 @@ paths:avs_response:cvv_response_code:cvv_response_message:- created_at: '2026-08-06T21:01:29.643Z'- updated_at: '2026-08-06T21:01:29.643Z'+ created_at: '2026-08-07T20:49:21.255Z'+ updated_at: '2026-08-07T20:49:21.255Z'captured_amount: '0.0'order_id: or_gbHJdmfrXBrequestBody:@@ -13214,8 +13227,8 @@ paths:example:id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJ- response_code: BGS-6fd45fced764- number: PFG6RI7L+ response_code: BGS-419e930324ec+ number: PZBJFOIYamount: '110.0'display_amount: "$110.00"status: completed@@ -13233,14 +13246,14 @@ paths:customer_id:payment_method_id: pm_gbHJdmfrXBmetadata: {}- created_at: '2026-08-06T21:01:29.731Z'- updated_at: '2026-08-06T21:01:29.733Z'+ created_at: '2026-08-07T20:49:21.333Z'+ updated_at: '2026-08-07T20:49:21.336Z'metadata: {}avs_response:cvv_response_code:cvv_response_message:- created_at: '2026-08-06T21:01:29.732Z'- updated_at: '2026-08-06T21:01:29.732Z'+ created_at: '2026-08-07T20:49:21.335Z'+ updated_at: '2026-08-07T20:49:21.335Z'captured_amount: '0.0'order_id: or_UkLWZg9DAJ"/api/v3/admin/orders/{order_id}/payments/{id}/capture":@@ -13303,8 +13316,8 @@ paths:example:id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJ- response_code: BGS-893f88f56b72- number: P17Y51ZW+ response_code: BGS-f315e522122f+ number: P09H0OCQamount: '110.0'display_amount: "$110.00"status: completed@@ -13322,14 +13335,14 @@ paths:customer_id:payment_method_id: pm_gbHJdmfrXBmetadata: {}- created_at: '2026-08-06T21:01:29.844Z'- updated_at: '2026-08-06T21:01:29.847Z'+ created_at: '2026-08-07T20:49:21.444Z'+ updated_at: '2026-08-07T20:49:21.446Z'metadata: {}avs_response:cvv_response_code:cvv_response_message:- created_at: '2026-08-06T21:01:29.846Z'- updated_at: '2026-08-06T21:01:29.894Z'+ created_at: '2026-08-07T20:49:21.445Z'+ updated_at: '2026-08-07T20:49:21.476Z'captured_amount: '110.0'order_id: or_UkLWZg9DAJ'422':@@ -13401,8 +13414,8 @@ paths:example:id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJ- response_code: void-BGS-b00d77f7ba1c- number: PWCEP5VD+ response_code: void-BGS-4f6420f2151d+ number: P6LWV5FIamount: '110.0'display_amount: "$110.00"status: void@@ -13420,14 +13433,14 @@ paths:customer_id:payment_method_id: pm_gbHJdmfrXBmetadata: {}- created_at: '2026-08-06T21:01:30.112Z'- updated_at: '2026-08-06T21:01:30.115Z'+ created_at: '2026-08-07T20:49:21.722Z'+ updated_at: '2026-08-07T20:49:21.726Z'metadata: {}avs_response:cvv_response_code:cvv_response_message:- created_at: '2026-08-06T21:01:30.113Z'- updated_at: '2026-08-06T21:01:30.141Z'+ created_at: '2026-08-07T20:49:21.725Z'+ updated_at: '2026-08-07T20:49:21.754Z'captured_amount: '0.0'order_id: or_UkLWZg9DAJ"/api/v3/admin/price_lists":@@ -13515,8 +13528,8 @@ paths:starts_at:ends_at:deleted_at:- created_at: '2026-08-06T21:01:32.004Z'- updated_at: '2026-08-06T21:01:32.004Z'+ created_at: '2026-08-07T20:49:23.388Z'+ updated_at: '2026-08-07T20:49:23.388Z'currently_active: falseproducts_count: 0prices_count: 0@@ -13530,8 +13543,8 @@ paths:starts_at:ends_at:deleted_at:- created_at: '2026-08-06T21:01:32.005Z'- updated_at: '2026-08-06T21:01:32.005Z'+ created_at: '2026-08-07T20:49:23.390Z'+ updated_at: '2026-08-07T20:49:23.390Z'currently_active: falseproducts_count: 0prices_count: 0@@ -13645,8 +13658,8 @@ paths:starts_at:ends_at:deleted_at:- created_at: '2026-08-06T21:01:32.198Z'- updated_at: '2026-08-06T21:01:32.200Z'+ created_at: '2026-08-07T20:49:23.563Z'+ updated_at: '2026-08-07T20:49:23.565Z'currently_active: falseproducts_count: 1prices_count: 2@@ -13809,8 +13822,8 @@ paths:starts_at:ends_at:deleted_at:- created_at: '2026-08-06T21:01:32.238Z'- updated_at: '2026-08-06T21:01:32.238Z'+ created_at: '2026-08-07T20:49:23.599Z'+ updated_at: '2026-08-07T20:49:23.599Z'currently_active: falseproducts_count: 0prices_count: 0@@ -13885,8 +13898,8 @@ paths:starts_at:ends_at:deleted_at:- created_at: '2026-08-06T21:01:32.496Z'- updated_at: '2026-08-06T21:01:32.515Z'+ created_at: '2026-08-07T20:49:23.844Z'+ updated_at: '2026-08-07T20:49:23.862Z'currently_active: falseproducts_count: 0prices_count: 0@@ -14074,8 +14087,8 @@ paths:starts_at:ends_at:deleted_at:- created_at: '2026-08-06T21:01:32.549Z'- updated_at: '2026-08-06T21:01:32.564Z'+ created_at: '2026-08-07T20:49:23.895Z'+ updated_at: '2026-08-07T20:49:23.912Z'currently_active: trueproducts_count: 0prices_count: 0@@ -14138,8 +14151,8 @@ paths:starts_at:ends_at:deleted_at:- created_at: '2026-08-06T21:01:32.573Z'- updated_at: '2026-08-06T21:01:32.589Z'+ created_at: '2026-08-07T20:49:23.921Z'+ updated_at: '2026-08-07T20:49:23.939Z'currently_active: falseproducts_count: 0prices_count: 0@@ -14253,8 +14266,8 @@ paths:display_compare_at_amount:price_list_id:variant_id: variant_UkLWZg9DAJ- created_at: '2026-08-06T21:01:32.620Z'- updated_at: '2026-08-06T21:01:32.620Z'+ created_at: '2026-08-07T20:49:23.973Z'+ updated_at: '2026-08-07T20:49:23.973Z'- id: price_gbHJdmfrXBamount: '19.99'amount_in_cents: 1999@@ -14265,8 +14278,8 @@ paths:display_compare_at_amount:price_list_id:variant_id: variant_gbHJdmfrXB- created_at: '2026-08-06T21:01:32.640Z'- updated_at: '2026-08-06T21:01:32.640Z'+ created_at: '2026-08-07T20:49:23.994Z'+ updated_at: '2026-08-07T20:49:23.994Z'- id: price_EfhxLZ9ck8amount: '5.0'amount_in_cents: 500@@ -14277,8 +14290,8 @@ paths:display_compare_at_amount:price_list_id: pl_UkLWZg9DAJvariant_id: variant_gbHJdmfrXB- created_at: '2026-08-06T21:01:32.643Z'- updated_at: '2026-08-06T21:01:32.643Z'+ created_at: '2026-08-07T20:49:23.998Z'+ updated_at: '2026-08-07T20:49:23.998Z'meta:page: 1limit: 25@@ -14360,8 +14373,8 @@ paths:display_compare_at_amount:price_list_id:variant_id: variant_EfhxLZ9ck8- created_at: '2026-08-06T21:01:32.767Z'- updated_at: '2026-08-06T21:01:32.767Z'+ created_at: '2026-08-07T20:49:24.122Z'+ updated_at: '2026-08-07T20:49:24.122Z'schema:"$ref": "#/components/schemas/Price"requestBody:@@ -14448,8 +14461,8 @@ paths:display_compare_at_amount:price_list_id: pl_UkLWZg9DAJvariant_id: variant_gbHJdmfrXB- created_at: '2026-08-06T21:01:32.829Z'- updated_at: '2026-08-06T21:01:32.829Z'+ created_at: '2026-08-07T20:49:24.179Z'+ updated_at: '2026-08-07T20:49:24.179Z'schema:"$ref": "#/components/schemas/Price"'404':@@ -14514,8 +14527,8 @@ paths:display_compare_at_amount:price_list_id: pl_UkLWZg9DAJvariant_id: variant_gbHJdmfrXB- created_at: '2026-08-06T21:01:32.964Z'- updated_at: '2026-08-06T21:01:32.981Z'+ created_at: '2026-08-07T20:49:24.311Z'+ updated_at: '2026-08-07T20:49:24.326Z'schema:"$ref": "#/components/schemas/Price"requestBody:@@ -14827,8 +14840,8 @@ paths:field_type: short_textkey: custom.titlevalue: wool- created_at: '2026-08-06T21:01:33.548Z'- updated_at: '2026-08-06T21:01:33.548Z'+ created_at: '2026-08-07T20:49:24.912Z'+ updated_at: '2026-08-07T20:49:24.912Z'storefront_visible: truecustom_field_definition_id: cfdef_UkLWZg9DAJmeta:@@ -14898,8 +14911,8 @@ paths:field_type: long_textkey: custom.descriptionvalue: A longer description- created_at: '2026-08-06T21:01:33.633Z'- updated_at: '2026-08-06T21:01:33.633Z'+ created_at: '2026-08-07T20:49:25.052Z'+ updated_at: '2026-08-07T20:49:25.052Z'storefront_visible: truecustom_field_definition_id: cfdef_gbHJdmfrXB'422':@@ -14998,8 +15011,8 @@ paths:field_type: short_textkey: custom.titlevalue: wool- created_at: '2026-08-06T21:01:33.725Z'- updated_at: '2026-08-06T21:01:33.725Z'+ created_at: '2026-08-07T20:49:25.139Z'+ updated_at: '2026-08-07T20:49:25.139Z'storefront_visible: truecustom_field_definition_id: cfdef_UkLWZg9DAJpatch:@@ -15063,8 +15076,8 @@ paths:field_type: short_textkey: custom.titlevalue: cotton- created_at: '2026-08-06T21:01:33.778Z'- updated_at: '2026-08-06T21:01:33.813Z'+ created_at: '2026-08-07T20:49:25.185Z'+ updated_at: '2026-08-07T20:49:25.202Z'storefront_visible: truecustom_field_definition_id: cfdef_UkLWZg9DAJrequestBody:@@ -15182,12 +15195,10 @@ paths:source: Espresso Machine- key: descriptiontype: html- source: |-- Eaque nesciunt qui itaque atque sunt. Eveniet quaerat rerum eaque eligendi. Maiores ratione provident blanditiis optio quis.- Suscipit quasi nisi velit ea a maxime non. Fuga quis beatae aliquid exercitationem facilis. Molestiae sequi nihil quos eligendi qui. Laboriosam pariatur nisi voluptatum rem dolor.- Amet labore voluptate asperiores saepe molestias placeat sunt quod. Iste doloremque corrupti debitis accusamus possimus. Fuga magni perferendis at molestias est unde. Possimus animi rem sequi ipsa ipsum rerum ab.- Ipsum illo numquam consequatur accusamus molestiae quasi nulla adipisci. Minus voluptatum doloremque commodi delectus suscipit ipsum. Quaerat voluptates animi dignissimos aliquid id.- Ratione consequatur quos mollitia nobis laborum sapiente eius. Soluta beatae magnam tenetur alias perspiciatis illo sit ipsam. Iure natus voluptate quo quisquam explicabo doloribus soluta voluptates. Nisi veniam atque saepe vitae non exercitationem sit.+ source: Nam voluptas ullam nobis alias exercitationem facere.+ Eligendi reiciendis eveniet velit ut aliquam tenetur. Accusamus+ dolor illo saepe ex. Laboriosam consequuntur recusandae eveniet+ laborum in. Rerum voluptatum consequuntur cumque fugiat.- key: slugtype: stringsource: espresso-machine@@ -15298,8 +15309,8 @@ paths:example:data:- id: prod_UkLWZg9DAJ- name: Product 729947- slug: product-729947+ name: Product 721911+ slug: product-721911meta_title:meta_description:meta_keywords:@@ -15311,31 +15322,14 @@ paths:in_stock: falsebackorderable: trueavailable: true- description: Dolorum optio esse repudiandae minima laudantium. Velit- maiores officia laboriosam labore iure. Suscipit repellat occaecati- accusantium quaerat. Tempora possimus numquam quibusdam sequi- iusto incidunt minima recusandae. Error nihil cum et accusamus.- Provident temporibus quae voluptas nam ipsum quas vel. Esse ullam- dolore eius impedit tempora. Repellendus ratione eos ad magnam- aut voluptatibus quae. Autem cumque culpa voluptatem adipisci- cupiditate ipsa. Ipsa pariatur exercitationem labore voluptas- nobis. Neque vero veritatis esse maiores ea eum optio labore.- Voluptatibus inventore laudantium voluptates beatae est unde.- Tempora voluptatem architecto dolor debitis vel nobis. Maiores- consequatur sed harum tempora. Quasi quia accusamus cum reiciendis- voluptates blanditiis. Iure mollitia eum velit ipsam sequi natus.- Aut incidunt blanditiis culpa aliquid veritatis accusantium. Saepe- nesciunt dolorem libero repellat asperiores dolor. Quis reiciendis- unde eius soluta aliquam vero dolorum laboriosam. Ipsam explicabo- deserunt blanditiis repellendus praesentium modi assumenda. Temporibus- nulla minus id architecto quisquam mollitia assumenda a. Recusandae- doloremque voluptate perspiciatis rem corrupti beatae alias.- description_html: |-- Dolorum optio esse repudiandae minima laudantium. Velit maiores officia laboriosam labore iure. Suscipit repellat occaecati accusantium quaerat. Tempora possimus numquam quibusdam sequi iusto incidunt minima recusandae. Error nihil cum et accusamus.- Provident temporibus quae voluptas nam ipsum quas vel. Esse ullam dolore eius impedit tempora. Repellendus ratione eos ad magnam aut voluptatibus quae.- Autem cumque culpa voluptatem adipisci cupiditate ipsa. Ipsa pariatur exercitationem labore voluptas nobis. Neque vero veritatis esse maiores ea eum optio labore. Voluptatibus inventore laudantium voluptates beatae est unde. Tempora voluptatem architecto dolor debitis vel nobis.- Maiores consequatur sed harum tempora. Quasi quia accusamus cum reiciendis voluptates blanditiis. Iure mollitia eum velit ipsam sequi natus. Aut incidunt blanditiis culpa aliquid veritatis accusantium.- Saepe nesciunt dolorem libero repellat asperiores dolor. Quis reiciendis unde eius soluta aliquam vero dolorum laboriosam. Ipsam explicabo deserunt blanditiis repellendus praesentium modi assumenda. Temporibus nulla minus id architecto quisquam mollitia assumenda a. Recusandae doloremque voluptate perspiciatis rem corrupti beatae alias.+ description: Impedit expedita tempore asperiores distinctio. Voluptatibus+ tenetur illo libero optio earum eos. Iste magnam magni ab mollitia+ deleniti. Error molestias illum repellendus tenetur ut ipsam beatae+ natus.+ description_html: Impedit expedita tempore asperiores distinctio.+ Voluptatibus tenetur illo libero optio earum eos. Iste magnam+ magni ab mollitia deleniti. Error molestias illum repellendus+ tenetur ut ipsam beatae natus.default_variant_id: variant_UkLWZg9DAJthumbnail_url:tags: []@@ -15350,14 +15344,14 @@ paths:display_compare_at_amount:price_list_id:variant_id: variant_UkLWZg9DAJ- created_at: '2026-08-06T21:01:34.059Z'- updated_at: '2026-08-06T21:01:34.059Z'+ created_at: '2026-08-07T20:49:25.329Z'+ updated_at: '2026-08-07T20:49:25.329Z'original_price:status: activemetadata: {}deleted_at:- created_at: '2026-08-06T21:01:34.048Z'- updated_at: '2026-08-06T21:01:34.065Z'+ created_at: '2026-08-07T20:49:25.320Z'+ updated_at: '2026-08-07T20:49:25.334Z'product_type_id:tax_category_id: taxcat_UkLWZg9DAJmeta:@@ -15492,8 +15486,8 @@ paths:status: draftmetadata: {}deleted_at:- created_at: '2026-08-06T21:01:34.192Z'- updated_at: '2026-08-06T21:01:34.197Z'+ created_at: '2026-08-07T20:49:25.463Z'+ updated_at: '2026-08-07T20:49:25.467Z'product_type_id:tax_category_id:schema:@@ -15699,8 +15693,8 @@ paths:application/json:example:id: prod_UkLWZg9DAJ- name: Product 763759- slug: product-763759+ name: Product 766188+ slug: product-766188meta_title:meta_description:meta_keywords:@@ -15712,22 +15706,30 @@ paths:in_stock: falsebackorderable: trueavailable: true- description: Aliquid laudantium dignissimos impedit cumque voluptates.- Doloribus sint doloremque soluta sapiente. Officiis reprehenderit- tempora adipisci necessitatibus molestiae. At iure doloremque soluta- ullam necessitatibus harum. Unde veritatis molestias perspiciatis- laudantium placeat at quo facere. Harum earum aperiam eveniet commodi- nihil ut. Velit atque explicabo impedit rem sunt quis. Magnam facilis- perferendis aut ullam. Eos facilis dolorem eius neque numquam ut- veniam. Magnam id beatae minima vitae facilis fuga. Quidem voluptate- cupiditate molestias consequatur animi commodi delectus. Vero harum- sunt sapiente vitae perspiciatis incidunt cumque vel. Atque molestiae- necessitatibus itaque quasi quibusdam voluptatibus et hic.+ description: Dignissimos natus eum quis cum deserunt dolor corporis.+ Possimus voluptate voluptatum cum eum fugit dignissimos itaque aperiam.+ Repellat pariatur ipsam odit fugit delectus. Sunt cupiditate excepturi+ laborum quas quos illo rerum. Voluptates numquam magni itaque commodi+ blanditiis fugiat omnis. Odio voluptatibus placeat officia asperiores+ at. Alias facere eum blanditiis non distinctio rem deleniti nesciunt.+ Quo eveniet voluptate a officiis fugit mollitia corporis excepturi.+ Perspiciatis officia eveniet ab sed voluptate laudantium facilis.+ Deserunt odit sint debitis facilis officia voluptatibus dolorum+ amet. Ipsa nisi veritatis facere doloribus animi. Possimus amet+ mollitia soluta dolores nihil earum iure. Autem maxime ex sed modi+ id sunt. Esse nostrum maxime quos atque. Natus nemo pariatur aut+ alias nesciunt. Minima sequi vitae modi consectetur amet ipsam asperiores+ adipisci. Dignissimos odio excepturi reiciendis error dicta exercitationem+ laboriosam aperiam. Quaerat aut dolorem iste molestiae pariatur.+ Ut minima accusantium ea quam. Voluptatibus perferendis sapiente+ consequuntur sed libero facilis doloribus. Unde odit in quas voluptatem+ fuga ratione.description_html: |-- Aliquid laudantium dignissimos impedit cumque voluptates. Doloribus sint doloremque soluta sapiente. Officiis reprehenderit tempora adipisci necessitatibus molestiae.- At iure doloremque soluta ullam necessitatibus harum. Unde veritatis molestias perspiciatis laudantium placeat at quo facere. Harum earum aperiam eveniet commodi nihil ut.- Velit atque explicabo impedit rem sunt quis. Magnam facilis perferendis aut ullam. Eos facilis dolorem eius neque numquam ut veniam.- Magnam id beatae minima vitae facilis fuga. Quidem voluptate cupiditate molestias consequatur animi commodi delectus. Vero harum sunt sapiente vitae perspiciatis incidunt cumque vel. Atque molestiae necessitatibus itaque quasi quibusdam voluptatibus et hic.+ Dignissimos natus eum quis cum deserunt dolor corporis. Possimus voluptate voluptatum cum eum fugit dignissimos itaque aperiam. Repellat pariatur ipsam odit fugit delectus.+ Sunt cupiditate excepturi laborum quas quos illo rerum. Voluptates numquam magni itaque commodi blanditiis fugiat omnis. Odio voluptatibus placeat officia asperiores at. Alias facere eum blanditiis non distinctio rem deleniti nesciunt. Quo eveniet voluptate a officiis fugit mollitia corporis excepturi.+ Perspiciatis officia eveniet ab sed voluptate laudantium facilis. Deserunt odit sint debitis facilis officia voluptatibus dolorum amet. Ipsa nisi veritatis facere doloribus animi.+ Possimus amet mollitia soluta dolores nihil earum iure. Autem maxime ex sed modi id sunt. Esse nostrum maxime quos atque. Natus nemo pariatur aut alias nesciunt. Minima sequi vitae modi consectetur amet ipsam asperiores adipisci.+ Dignissimos odio excepturi reiciendis error dicta exercitationem laboriosam aperiam. Quaerat aut dolorem iste molestiae pariatur. Ut minima accusantium ea quam. Voluptatibus perferendis sapiente consequuntur sed libero facilis doloribus. Unde odit in quas voluptatem fuga ratione.default_variant_id: variant_UkLWZg9DAJthumbnail_url:tags: []@@ -15742,14 +15744,14 @@ paths:display_compare_at_amount:price_list_id:variant_id: variant_UkLWZg9DAJ- created_at: '2026-08-06T21:01:34.297Z'- updated_at: '2026-08-06T21:01:34.297Z'+ created_at: '2026-08-07T20:49:25.583Z'+ updated_at: '2026-08-07T20:49:25.583Z'original_price:status: activemetadata: {}deleted_at:- created_at: '2026-08-06T21:01:34.286Z'- updated_at: '2026-08-06T21:01:34.302Z'+ created_at: '2026-08-07T20:49:25.573Z'+ updated_at: '2026-08-07T20:49:25.588Z'product_type_id:tax_category_id: taxcat_UkLWZg9DAJschema:@@ -15820,7 +15822,7 @@ paths:example:id: prod_UkLWZg9DAJname: Updated Name- slug: product-782536+ slug: product-785877meta_title:meta_description:meta_keywords:@@ -15832,24 +15834,12 @@ paths:in_stock: falsebackorderable: trueavailable: true- description: Itaque assumenda amet accusamus eius maxime. Ab iure- perspiciatis mollitia ad. Vero temporibus id exercitationem itaque- ducimus. Nam tempore cumque praesentium temporibus incidunt. Fuga- pariatur dicta tenetur dolor expedita ducimus consequatur repellendus.- Quae nihil reiciendis vitae enim sint. Odio similique facere assumenda- blanditiis iure accusamus. Tenetur quaerat rem doloribus reiciendis- esse quae aliquam. Dolorem eveniet veniam ex occaecati voluptatum- excepturi itaque. Aut unde facere atque voluptates ex modi error.- Quae error dolorum enim laborum impedit ullam adipisci voluptates.- Voluptas adipisci minus odit officia eum dignissimos. Amet tenetur- corporis veniam architecto non dolore sequi. Illum autem distinctio- a repellendus velit in reiciendis. Beatae perferendis veniam praesentium- amet illo consequatur atque.- description_html: |-- Itaque assumenda amet accusamus eius maxime. Ab iure perspiciatis mollitia ad. Vero temporibus id exercitationem itaque ducimus.- Nam tempore cumque praesentium temporibus incidunt. Fuga pariatur dicta tenetur dolor expedita ducimus consequatur repellendus. Quae nihil reiciendis vitae enim sint.- Odio similique facere assumenda blanditiis iure accusamus. Tenetur quaerat rem doloribus reiciendis esse quae aliquam. Dolorem eveniet veniam ex occaecati voluptatum excepturi itaque. Aut unde facere atque voluptates ex modi error. Quae error dolorum enim laborum impedit ullam adipisci voluptates.- Voluptas adipisci minus odit officia eum dignissimos. Amet tenetur corporis veniam architecto non dolore sequi. Illum autem distinctio a repellendus velit in reiciendis. Beatae perferendis veniam praesentium amet illo consequatur atque.+ description: Unde adipisci magni ipsam perferendis. Neque voluptatibus+ ex repellendus quia consequuntur natus eveniet. Sapiente qui perspiciatis+ adipisci cum minima quaerat repudiandae.+ description_html: Unde adipisci magni ipsam perferendis. Neque voluptatibus+ ex repellendus quia consequuntur natus eveniet. Sapiente qui perspiciatis+ adipisci cum minima quaerat repudiandae.default_variant_id: variant_UkLWZg9DAJthumbnail_url:tags: []@@ -15864,14 +15854,14 @@ paths:display_compare_at_amount:price_list_id:variant_id: variant_UkLWZg9DAJ- created_at: '2026-08-06T21:01:34.432Z'- updated_at: '2026-08-06T21:01:34.432Z'+ created_at: '2026-08-07T20:49:25.691Z'+ updated_at: '2026-08-07T20:49:25.691Z'original_price:status: activemetadata: {}deleted_at:- created_at: '2026-08-06T21:01:34.422Z'- updated_at: '2026-08-06T21:01:34.460Z'+ created_at: '2026-08-07T20:49:25.682Z'+ updated_at: '2026-08-07T20:49:25.717Z'product_type_id:tax_category_id: taxcat_UkLWZg9DAJschema:@@ -16802,15 +16792,15 @@ paths:- id: coupon_UkLWZg9DAJcode: AAA111state: unused- created_at: '2026-08-06T21:01:23.192Z'- updated_at: '2026-08-06T21:01:23.192Z'+ created_at: '2026-08-07T20:49:15.456Z'+ updated_at: '2026-08-07T20:49:15.456Z'promotion_id: promo_UkLWZg9DAJorder_id:- id: coupon_gbHJdmfrXBcode: BBB222state: unused- created_at: '2026-08-06T21:01:23.193Z'- updated_at: '2026-08-06T21:01:23.193Z'+ created_at: '2026-08-07T20:49:15.457Z'+ updated_at: '2026-08-07T20:49:15.457Z'promotion_id: promo_UkLWZg9DAJorder_id:meta:@@ -16872,8 +16862,8 @@ paths:example:data:- id: pact_UkLWZg9DAJ- created_at: '2026-08-06T21:01:35.421Z'- updated_at: '2026-08-06T21:01:35.421Z'+ created_at: '2026-08-07T20:49:26.655Z'+ updated_at: '2026-08-07T20:49:26.655Z'type: free_shippingpromotion_id: promo_UkLWZg9DAJpreferences: {}@@ -16937,8 +16927,8 @@ paths:application/json:example:id: pact_UkLWZg9DAJ- created_at: '2026-08-06T21:01:35.519Z'- updated_at: '2026-08-06T21:01:35.519Z'+ created_at: '2026-08-07T20:49:26.731Z'+ updated_at: '2026-08-07T20:49:26.731Z'type: free_shippingpromotion_id: promo_UkLWZg9DAJpreferences: {}@@ -17066,8 +17056,8 @@ paths:example:data:- id: prorule_UkLWZg9DAJ- created_at: '2026-08-06T21:01:35.602Z'- updated_at: '2026-08-06T21:01:35.602Z'+ created_at: '2026-08-07T20:49:26.797Z'+ updated_at: '2026-08-07T20:49:26.797Z'type: currencypromotion_id: promo_UkLWZg9DAJpreferences:@@ -17137,8 +17127,8 @@ paths:application/json:example:id: prorule_UkLWZg9DAJ- created_at: '2026-08-06T21:01:35.644Z'- updated_at: '2026-08-06T21:01:35.644Z'+ created_at: '2026-08-07T20:49:26.833Z'+ updated_at: '2026-08-07T20:49:26.833Z'type: currencypromotion_id: promo_UkLWZg9DAJpreferences:@@ -17229,8 +17219,8 @@ paths:application/json:example:id: prorule_UkLWZg9DAJ- created_at: '2026-08-06T21:01:35.669Z'- updated_at: '2026-08-06T21:01:35.687Z'+ created_at: '2026-08-07T20:49:26.858Z'+ updated_at: '2026-08-07T20:49:26.874Z'type: currencypromotion_id: promo_UkLWZg9DAJpreferences:@@ -17338,7 +17328,7 @@ paths:name: Summer Saledescription:code: summer- starts_at: '2026-08-06T21:01:35.721Z'+ starts_at: '2026-08-07T20:49:26.903Z'expires_at:usage_limit:match_policy: all@@ -17349,8 +17339,8 @@ paths:code_prefix:promotion_category_id:metadata: {}- created_at: '2026-08-06T21:01:35.721Z'- updated_at: '2026-08-06T21:01:35.721Z'+ created_at: '2026-08-07T20:49:26.904Z'+ updated_at: '2026-08-07T20:49:26.904Z'action_ids: []rule_ids: []meta:@@ -17457,7 +17447,7 @@ paths:name: Black Fridaydescription:code: blackfriday-os- starts_at: '2026-08-06T21:01:35.861Z'+ starts_at: '2026-08-07T20:49:27.011Z'expires_at:usage_limit:match_policy: all@@ -17468,8 +17458,8 @@ paths:code_prefix:promotion_category_id:metadata: {}- created_at: '2026-08-06T21:01:35.862Z'- updated_at: '2026-08-06T21:01:35.879Z'+ created_at: '2026-08-07T20:49:27.011Z'+ updated_at: '2026-08-07T20:49:27.030Z'action_ids:- pact_UkLWZg9DAJ- pact_gbHJdmfrXB@@ -17635,7 +17625,7 @@ paths:name: Summer Saledescription:code: summer- starts_at: '2026-08-06T21:01:35.910Z'+ starts_at: '2026-08-07T20:49:27.061Z'expires_at:usage_limit:match_policy: all@@ -17646,8 +17636,8 @@ paths:code_prefix:promotion_category_id:metadata: {}- created_at: '2026-08-06T21:01:35.910Z'- updated_at: '2026-08-06T21:01:35.910Z'+ created_at: '2026-08-07T20:49:27.061Z'+ updated_at: '2026-08-07T20:49:27.061Z'action_ids: []rule_ids: []patch:@@ -17744,7 +17734,7 @@ paths:name: Summer Saledescription:code: summer- starts_at: '2026-08-06T21:01:36.017Z'+ starts_at: '2026-08-07T20:49:27.149Z'expires_at:usage_limit:match_policy: all@@ -17755,8 +17745,8 @@ paths:code_prefix:promotion_category_id:metadata: {}- created_at: '2026-08-06T21:01:36.017Z'- updated_at: '2026-08-06T21:01:36.034Z'+ created_at: '2026-08-07T20:49:27.149Z'+ updated_at: '2026-08-07T20:49:27.169Z'action_ids: []rule_ids: []requestBody:@@ -18228,15 +18218,15 @@ paths:application/json:example:id: re_UkLWZg9DAJ- transaction_id: BGS-d8e7860e22a5+ transaction_id: BGS-dc60b490dc3famount: '5.0'payment_id: py_UkLWZg9DAJrefund_reason_id: rr_UkLWZg9DAJoriginator_id:originator_type:metadata: {}- created_at: '2026-08-06T21:01:30.386Z'- updated_at: '2026-08-06T21:01:30.386Z'+ created_at: '2026-08-07T20:49:21.978Z'+ updated_at: '2026-08-07T20:49:21.978Z'requestBody:content:application/json:@@ -18380,8 +18370,8 @@ paths:data:- id: sccat_UkLWZg9DAJname: Goodwill- created_at: '2026-08-06T21:01:36.371Z'- updated_at: '2026-08-06T21:01:36.371Z'+ created_at: '2026-08-07T20:49:27.590Z'+ updated_at: '2026-08-07T20:49:27.590Z'non_expiring: falsemeta:page: 1@@ -18475,8 +18465,8 @@ paths:example:id: sccat_UkLWZg9DAJname: Goodwill- created_at: '2026-08-06T21:01:36.406Z'- updated_at: '2026-08-06T21:01:36.406Z'+ created_at: '2026-08-07T20:49:27.623Z'+ updated_at: '2026-08-07T20:49:27.623Z'non_expiring: falseschema:"$ref": "#/components/schemas/StoreCreditCategory"@@ -18553,8 +18543,8 @@ paths:preferred_storefront_access: publicpreferred_guest_checkout: truepreferred_order_routing_strategy: Spree::OrderRouting::Strategy::Rules- created_at: '2026-08-06T21:01:20.848Z'- updated_at: '2026-08-06T21:01:36.457Z'+ created_at: '2026-08-07T20:49:13.267Z'+ updated_at: '2026-08-07T20:49:27.672Z'url: http://www.example.com:3000api_url: http://www.example.com:3000setup_tasks:@@ -18851,8 +18841,8 @@ paths:preferred_storefront_access: publicpreferred_guest_checkout: truepreferred_order_routing_strategy: Spree::OrderRouting::Strategy::Rules- created_at: '2026-08-06T21:01:20.848Z'- updated_at: '2026-08-06T21:01:36.541Z'+ created_at: '2026-08-07T20:49:13.267Z'+ updated_at: '2026-08-07T20:49:27.749Z'url: http://www.example.com:3000api_url: http://www.example.com:3000setup_tasks:@@ -19395,7 +19385,7 @@ paths:description: |-Returns admin users with at least one role assignment on the current store.- **Required scope:** `read_settings` (for API-key authentication).+ **Required scope:** `read_staff` (for API-key authentication).x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -19430,13 +19420,13 @@ paths:example:data:- id: adm_UkLWZg9DAJ- email: [email protected]- first_name: Leonarda- last_name: Bailey- full_name: Leonarda Bailey+ email: [email protected]+ first_name: Prudence+ last_name: Steuber+ full_name: Prudence Steuberselected_locale:- created_at: '2026-08-06T21:01:20.946Z'- updated_at: '2026-08-06T21:01:20.946Z'+ created_at: '2026-08-07T20:49:13.381Z'+ updated_at: '2026-08-07T20:49:13.381Z'avatar_url:roles:- id: role_UkLWZg9DAJ@@ -19463,7 +19453,7 @@ paths:security:- api_key: []bearer_auth: []- description: "**Required scope:** `read_settings` (for API-key authentication)."+ description: "**Required scope:** `read_staff` (for API-key authentication)."x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -19502,13 +19492,13 @@ paths:application/json:example:id: adm_UkLWZg9DAJ- email: [email protected]- first_name: Diego- last_name: Douglas- full_name: Diego Douglas+ email: [email protected]+ first_name: Jerilyn+ last_name: Herman+ full_name: Jerilyn Hermanselected_locale:- created_at: '2026-08-06T21:01:21.068Z'- updated_at: '2026-08-06T21:01:21.068Z'+ created_at: '2026-08-07T20:49:13.460Z'+ updated_at: '2026-08-07T20:49:13.460Z'avatar_url:roles:- id: role_UkLWZg9DAJ@@ -19527,7 +19517,7 @@ paths: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.- **Required scope:** `write_settings` (for API-key authentication).+ **Required scope:** `write_staff` (for API-key authentication).x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -19569,13 +19559,13 @@ paths:application/json:example:id: adm_UkLWZg9DAJ- email: [email protected]+ email: [email protected]first_name: Renamed- last_name: Cormier- full_name: Renamed Cormier+ last_name: Hegmann+ full_name: Renamed Hegmannselected_locale:- created_at: '2026-08-06T21:01:21.096Z'- updated_at: '2026-08-06T21:01:21.113Z'+ created_at: '2026-08-07T20:49:13.482Z'+ updated_at: '2026-08-07T20:49:13.496Z'avatar_url:roles:- id: role_UkLWZg9DAJ@@ -19610,7 +19600,7 @@ paths:description: |-Removes the user's role assignments on the current store. The account is preserved — the user keeps access to any other stores.- **Required scope:** `write_settings` (for API-key authentication).+ **Required scope:** `write_staff` (for API-key authentication).x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -19656,7 +19646,7 @@ paths:description: |-Returns invitations for the current store, including pending and accepted.- **Required scope:** `read_settings` (for API-key authentication).+ **Required scope:** `read_staff` (for API-key authentication).x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -19691,15 +19681,15 @@ paths:example:data:- id: inv_UkLWZg9DAJ- email: [email protected]+ email: [email protected]status: pending- created_at: '2026-08-06T21:01:25.578Z'- updated_at: '2026-08-06T21:01:25.578Z'- expires_at: '2026-08-20T21:01:25.575Z'+ created_at: '2026-08-07T20:49:17.601Z'+ updated_at: '2026-08-07T20:49:17.601Z'+ expires_at: '2026-08-21T20:49:17.599Z'role_id: role_UkLWZg9DAJrole_name: admin- inviter_email: [email protected]- acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=NVpNNvAMVi8U8NvfQUipebzU"+ inviter_email: [email protected]+ acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=nvKgigEw4WuV7pvf4RgeYp6z"invitee_exists: falsestore:id: store_UkLWZg9DAJ@@ -19724,7 +19714,7 @@ paths: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.- **Required scope:** `write_settings` (for API-key authentication).+ **Required scope:** `write_staff` (for API-key authentication).x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -19763,13 +19753,13 @@ paths:id: inv_gbHJdmfrXBemail: [email protected]status: pending- created_at: '2026-08-06T21:01:25.615Z'- updated_at: '2026-08-06T21:01:25.615Z'- expires_at: '2026-08-20T21:01:25.613Z'+ created_at: '2026-08-07T20:49:17.638Z'+ updated_at: '2026-08-07T20:49:17.638Z'+ expires_at: '2026-08-21T20:49:17.636Z'role_id: role_UkLWZg9DAJrole_name: admin- inviter_email: [email protected]- acceptance_url: "/accept-invitation/inv_gbHJdmfrXB?token=8hQfD8WkKfrtj9o5jQQDmW2W"+ inviter_email: [email protected]+ acceptance_url: "/accept-invitation/inv_gbHJdmfrXB?token=Wwf8ytmXfqBgbzaRN3k3cxrM"invitee_exists: falsestore:id: store_UkLWZg9DAJ@@ -19797,7 +19787,7 @@ paths:security:- api_key: []bearer_auth: []- description: "**Required scope:** `write_settings` (for API-key authentication)."+ description: "**Required scope:** `write_staff` (for API-key authentication)."x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -19843,7 +19833,7 @@ paths:description: |-Issues a fresh token and dispatches the invitation email again.- **Required scope:** `write_settings` (for API-key authentication).+ **Required scope:** `write_staff` (for API-key authentication).x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -19882,19 +19872,297 @@ paths:application/json:example:id: inv_UkLWZg9DAJ- email: [email protected]+ email: [email protected]status: pending- created_at: '2026-08-06T21:01:25.649Z'- updated_at: '2026-08-06T21:01:25.649Z'- expires_at: '2026-08-20T21:01:25.647Z'+ created_at: '2026-08-07T20:49:17.676Z'+ updated_at: '2026-08-07T20:49:17.676Z'+ expires_at: '2026-08-21T20:49:17.674Z'role_id: role_UkLWZg9DAJrole_name: admin- inviter_email: [email protected]- acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=2WFMAbqKUN1EJRw1LisjDzyW"+ inviter_email: [email protected]+ acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=cDqJm6Lf2xsySRuGF4u8Fanp"invitee_exists: falsestore:id: store_UkLWZg9DAJname: Spree Test Store+ "/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.+ x-codeSamples:+ - lang: javascript+ label: Spree Admin SDK+ source: |-+ import { createAdminClient } from '@spree/admin-sdk'++ const client = createAdminClient({+ baseUrl: 'https://your-store.com',+ secretKey: 'sk_xxx',+ })++ const { data: permissions } = await client.permissions.list()+ - lang: bash+ label: Spree CLI+ source: spree api get /permissions+ 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:+ example:+ data:+ - key: read_orders+ resource: orders+ kind: read+ group: orders+ group_label: Orders+ label: Orders+ description: Orders, line items, returns, exchanges and claims+ - key: write_orders+ resource: orders+ kind: write+ group: orders+ group_label: Orders+ label: Orders+ description: Orders, line items, returns, exchanges and claims+ - key: read_payments+ resource: payments+ kind: read+ group: orders+ group_label: Orders+ label: Payments+ description: Order payments and payment capture+ - key: write_payments+ resource: payments+ kind: write+ group: orders+ group_label: Orders+ label: Payments+ description: Order payments and payment capture+ - key: read_fulfillments+ resource: fulfillments+ kind: read+ group: orders+ group_label: Orders+ label: Fulfillments+ description: Pack, ship and track order fulfillments+ - key: write_fulfillments+ resource: fulfillments+ kind: write+ group: orders+ group_label: Orders+ label: Fulfillments+ description: Pack, ship and track order fulfillments+ - key: read_refunds+ resource: refunds+ kind: read+ group: orders+ group_label: Orders+ label: Refunds+ description: Issue and view refunds+ - key: write_refunds+ resource: refunds+ kind: write+ group: orders+ group_label: Orders+ label: Refunds+ description: Issue and view refunds+ - key: read_gift_cards+ resource: gift_cards+ kind: read+ group: orders+ group_label: Orders+ label: Gift cards+ description: Gift cards and gift card batches+ - key: write_gift_cards+ resource: gift_cards+ kind: write+ group: orders+ group_label: Orders+ label: Gift cards+ description: Gift cards and gift card batches+ - key: read_store_credits+ resource: store_credits+ kind: read+ group: orders+ group_label: Orders+ label: Store credits+ description: Customer store credit balances+ - key: write_store_credits+ resource: store_credits+ kind: write+ group: orders+ group_label: Orders+ label: Store credits+ description: Customer store credit balances+ - key: read_products+ resource: products+ kind: read+ group: catalog+ group_label: Catalog+ label: Products+ description: Products, variants, options, prices and media+ - key: write_products+ resource: products+ kind: write+ group: catalog+ group_label: Catalog+ label: Products+ description: Products, variants, options, prices and media+ - key: read_categories+ resource: categories+ kind: read+ group: catalog+ group_label: Catalog+ label: Categories+ description: Category tree and taxonomies+ - key: write_categories+ resource: categories+ kind: write+ group: catalog+ group_label: Catalog+ label: Categories+ description: Category tree and taxonomies+ - key: read_collections+ resource: collections+ kind: read+ group: catalog+ group_label: Catalog+ label: Collections+ description: Manual and rule-based product collections+ - key: write_collections+ resource: collections+ kind: write+ group: catalog+ group_label: Catalog+ label: Collections+ description: Manual and rule-based product collections+ - key: read_stock+ resource: stock+ kind: read+ group: catalog+ group_label: Catalog+ label: Inventory+ description: Stock levels, locations, movements and transfers+ - key: write_stock+ resource: stock+ kind: write+ group: catalog+ group_label: Catalog+ label: Inventory+ description: Stock levels, locations, movements and transfers+ - key: read_promotions+ resource: promotions+ kind: read+ group: marketing+ group_label: Marketing+ label: Promotions+ description: Promotions, rules and coupon codes+ - key: write_promotions+ resource: promotions+ kind: write+ group: marketing+ group_label: Marketing+ label: Promotions+ description: Promotions, rules and coupon codes+ - key: read_customers+ resource: customers+ kind: read+ group: customers+ group_label: Customers+ label: Customers+ description: Customer accounts, addresses, cards and groups+ - key: write_customers+ resource: customers+ kind: write+ group: customers+ group_label: Customers+ label: Customers+ description: Customer accounts, addresses, cards and groups+ - key: read_settings+ resource: settings+ kind: read+ group: settings+ group_label: Settings+ label: Store settings+ description: Store, payment, delivery, tax and channel configuration+ - key: write_settings+ resource: settings+ kind: write+ group: settings+ group_label: Settings+ label: Store settings+ description: Store, payment, delivery, tax and channel configuration+ - key: read_webhooks+ resource: webhooks+ kind: read+ group: settings+ group_label: Settings+ label: Webhooks+ description: Webhook endpoints and deliveries+ - key: write_webhooks+ resource: webhooks+ kind: write+ group: settings+ group_label: Settings+ label: Webhooks+ description: Webhook endpoints and deliveries+ - key: read_api_keys+ resource: api_keys+ kind: read+ group: access+ group_label: Access+ label: API keys+ description: Create and revoke API credentials+ - key: write_api_keys+ resource: api_keys+ kind: write+ group: access+ group_label: Access+ label: API keys+ description: Create and revoke API credentials+ - key: read_staff+ resource: staff+ kind: read+ group: access+ group_label: Access+ label: Staff & roles+ description: Team members, invitations, roles and their permissions+ - key: write_staff+ resource: staff+ kind: write+ group: access+ group_label: Access+ label: Staff & roles+ description: Team members, invitations, roles and their permissions+ - key: read_dashboard+ resource: dashboard+ kind: read+ group: analytics+ group_label: Analytics+ label: Analytics dashboard+ description: Sales and performance analytics+ meta:+ count: 33"/api/v3/admin/roles":get:summary: List roles@@ -19904,9 +20172,9 @@ paths:- api_key: []bearer_auth: []description: |-- Returns the roles available for staff role pickers. Roles are global, not per-store.+ Returns staff roles with their catalog permissions. Roles are global, not per-store; `mutable: false` marks the protected admin role and host-locked rows.- **Required scope:** `read_settings` (for API-key authentication).+ **Required scope:** `read_staff` (for API-key authentication).x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -19942,8 +20210,45 @@ paths:data:- id: role_UkLWZg9DAJname: admin- created_at: '2026-08-06T21:01:36.115Z'- updated_at: '2026-08-06T21:01:36.115Z'+ description:+ created_at: '2026-08-07T20:49:27.259Z'+ updated_at: '2026-08-07T20:49:27.259Z'+ permissions:+ - read_orders+ - write_orders+ - read_payments+ - write_payments+ - read_fulfillments+ - write_fulfillments+ - read_refunds+ - write_refunds+ - read_gift_cards+ - write_gift_cards+ - read_store_credits+ - write_store_credits+ - read_products+ - write_products+ - read_categories+ - write_categories+ - read_collections+ - write_collections+ - read_stock+ - write_stock+ - read_promotions+ - write_promotions+ - read_customers+ - write_customers+ - read_settings+ - write_settings+ - read_webhooks+ - write_webhooks+ - read_api_keys+ - write_api_keys+ - read_staff+ - write_staff+ - read_dashboard+ mutable: false+ users_count: 1meta:page: 1limit: 25@@ -19954,6 +20259,222 @@ paths:in: 1previous:next:+ 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.++ **Required scope:** `write_staff` (for API-key authentication).+ x-codeSamples:+ - lang: javascript+ label: Spree Admin SDK+ source: |-+ import { createAdminClient } from '@spree/admin-sdk'++ const client = createAdminClient({+ baseUrl: 'https://your-store.com',+ secretKey: 'sk_xxx',+ })++ const role = await client.roles.create({+ name: 'order_manager',+ description: 'Handles daily orders',+ permissions: ['write_orders', 'read_customers'],+ })+ - lang: bash+ label: Spree CLI+ source: spree api post /roles -d '{"name":"order_manager","description":"Handles+ daily orders","permissions":["write_orders","read_customers"]}'+ 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:+ example:+ id: role_gbHJdmfrXB+ name: order_manager+ description: Handles daily orders+ created_at: '2026-08-07T20:49:27.292Z'+ updated_at: '2026-08-07T20:49:27.292Z'+ permissions:+ - write_orders+ - read_customers+ mutable: true+ users_count: 0+ '422':+ description: invalid request+ content:+ application/json:+ example:+ error:+ code: validation_error+ message: 'Permissions contains unknown permissions: write_bogus'+ details:+ permissions:+ - 'contains unknown permissions: write_bogus'+ requestBody:+ content:+ application/json:+ schema:+ type: object+ properties:+ name:+ type: string+ example: order_manager+ description:+ type: string+ nullable: true+ example: Handles daily orders+ permissions:+ type: array+ items:+ type: string+ example:+ - write_orders+ - read_customers+ 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.++ **Required scope:** `write_staff` (for API-key authentication).+ x-codeSamples:+ - lang: javascript+ label: Spree Admin SDK+ source: |-+ import { createAdminClient } from '@spree/admin-sdk'++ const client = createAdminClient({+ baseUrl: 'https://your-store.com',+ secretKey: 'sk_xxx',+ })++ const role = await client.roles.update('role_abc123', {+ permissions: ['write_orders', 'write_payments', 'read_customers'],+ })+ - lang: bash+ label: Spree CLI+ source: spree api patch /roles/{id} -d '{"permissions":["write_orders","write_payments","read_customers"]}'+ 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:+ example:+ id: role_gbHJdmfrXB+ name: support+ description:+ created_at: '2026-08-07T20:49:27.315Z'+ updated_at: '2026-08-07T20:49:27.329Z'+ permissions:+ - read_orders+ - read_customers+ mutable: true+ users_count: 0+ 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.++ **Required scope:** `write_staff` (for API-key authentication).+ x-codeSamples:+ - lang: javascript+ label: Spree Admin SDK+ source: |-+ import { createAdminClient } from '@spree/admin-sdk'++ const client = createAdminClient({+ baseUrl: 'https://your-store.com',+ secretKey: 'sk_xxx',+ })++ await client.roles.delete('role_abc123')+ - lang: bash+ label: Spree CLI+ source: spree api delete /roles/{id}+ 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:+ example:+ error:+ code: validation_error+ message: Roles cannot be deleted"/api/v3/admin/stock_locations":get:summary: List stock locations@@ -20081,8 +20602,8 @@ paths:pickup_stock_policy: localpickup_ready_in_minutes:pickup_instructions:- created_at: '2026-08-06T21:01:36.141Z'- updated_at: '2026-08-06T21:01:36.141Z'+ created_at: '2026-08-07T20:49:27.372Z'+ updated_at: '2026-08-07T20:49:27.372Z'meta:page: 1limit: 25@@ -20196,8 +20717,8 @@ paths:pickup_stock_policy: localpickup_ready_in_minutes: 30pickup_instructions:- created_at: '2026-08-06T21:01:36.197Z'- updated_at: '2026-08-06T21:01:36.197Z'+ created_at: '2026-08-07T20:49:27.429Z'+ updated_at: '2026-08-07T20:49:27.429Z'schema:"$ref": "#/components/schemas/StockLocation"'422':@@ -20374,8 +20895,8 @@ paths:pickup_stock_policy: localpickup_ready_in_minutes:pickup_instructions:- created_at: '2026-08-06T21:01:36.240Z'- updated_at: '2026-08-06T21:01:36.240Z'+ created_at: '2026-08-07T20:49:27.462Z'+ updated_at: '2026-08-07T20:49:27.462Z'schema:"$ref": "#/components/schemas/StockLocation"'404':@@ -20464,8 +20985,8 @@ paths:pickup_stock_policy: localpickup_ready_in_minutes: 45pickup_instructions:- created_at: '2026-08-06T21:01:36.298Z'- updated_at: '2026-08-06T21:01:36.315Z'+ created_at: '2026-08-07T20:49:27.517Z'+ updated_at: '2026-08-07T20:49:27.534Z'schema:"$ref": "#/components/schemas/StockLocation"'422':@@ -20708,14 +21229,14 @@ paths:dimensions_unit:backorder_limit:deleted_at:- created_at: '2026-08-06T21:01:36.758Z'- updated_at: '2026-08-06T21:01:36.768Z'+ created_at: '2026-08-07T20:49:27.953Z'+ updated_at: '2026-08-07T20:49:27.962Z'preorderable: falsetax_category_id: taxcat_UkLWZg9DAJavailable_stock: 0reserved_quantity: 0total_on_hand: 0- product_name: Product 967084+ product_name: Product 96524- id: variant_gbHJdmfrXBproduct_id: prod_UkLWZg9DAJsku: SKU-116@@ -20728,10 +21249,10 @@ paths:in_stock: falsebackorderable: truepreorder: false- weight: 63.49- height: 20.58- width: 20.1- depth: 65.91+ weight: 5.68+ height: 161.77+ width: 17.11+ depth: 89.6price:id: price_gbHJdmfrXBamount: '19.99'@@ -20754,8 +21275,8 @@ paths:option_type_label: Sizeimage_url:metadata: {}- created_at: '2026-08-06T21:01:36.781Z'- updated_at: '2026-08-06T21:01:36.781Z'+ created_at: '2026-08-07T20:49:27.976Z'+ updated_at: '2026-08-07T20:49:27.976Z'metadata: {}position: 2cost_price: '17.0'@@ -20765,14 +21286,14 @@ paths:dimensions_unit:backorder_limit:deleted_at:- created_at: '2026-08-06T21:01:36.778Z'- updated_at: '2026-08-06T21:01:36.790Z'+ created_at: '2026-08-07T20:49:27.973Z'+ updated_at: '2026-08-07T20:49:27.982Z'preorderable: falsetax_category_id: taxcat_UkLWZg9DAJavailable_stock: 0reserved_quantity: 0total_on_hand: 0- product_name: Product 967084+ product_name: Product 96524meta:page: 1limit: 25@@ -20886,8 +21407,8 @@ paths:option_type_label: Sizeimage_url:metadata: {}- created_at: '2026-08-06T21:01:36.900Z'- updated_at: '2026-08-06T21:01:36.900Z'+ created_at: '2026-08-07T20:49:28.090Z'+ updated_at: '2026-08-07T20:49:28.090Z'metadata: {}position: 3cost_price:@@ -20897,14 +21418,14 @@ paths:dimensions_unit:backorder_limit:deleted_at:- created_at: '2026-08-06T21:01:36.904Z'- updated_at: '2026-08-06T21:01:36.905Z'+ created_at: '2026-08-07T20:49:28.095Z'+ updated_at: '2026-08-07T20:49:28.097Z'preorderable: falsetax_category_id: taxcat_UkLWZg9DAJavailable_stock: 0reserved_quantity: 0total_on_hand: 0- product_name: Product 97531+ product_name: Product 979718'422':description: validation errorcontent:@@ -21091,10 +21612,10 @@ paths:in_stock: falsebackorderable: truepreorder: false- weight: 147.23- height: 178.51- width: 26.85- depth: 51.13+ weight: 66.38+ height: 141.15+ width: 32.44+ depth: 11.61price:id: price_gbHJdmfrXBamount: '19.99'@@ -21117,8 +21638,8 @@ paths:option_type_label: Sizeimage_url:metadata: {}- created_at: '2026-08-06T21:01:37.047Z'- updated_at: '2026-08-06T21:01:37.047Z'+ created_at: '2026-08-07T20:49:28.245Z'+ updated_at: '2026-08-07T20:49:28.245Z'metadata: {}position: 2cost_price: '17.0'@@ -21128,14 +21649,14 @@ paths:dimensions_unit:backorder_limit:deleted_at:- created_at: '2026-08-06T21:01:37.045Z'- updated_at: '2026-08-06T21:01:37.055Z'+ created_at: '2026-08-07T20:49:28.243Z'+ updated_at: '2026-08-07T20:49:28.253Z'preorderable: falsetax_category_id: taxcat_UkLWZg9DAJavailable_stock: 0reserved_quantity: 0total_on_hand: 0- product_name: Product 992439+ product_name: Product 994543'404':description: variant not foundcontent:@@ -21219,10 +21740,10 @@ paths:in_stock: falsebackorderable: truepreorder: false- weight: 183.54- height: 106.8- width: 178.43- depth: 73.48+ weight: 44.48+ height: 178.9+ width: 79.4+ depth: 100.57price:id: price_gbHJdmfrXBamount: '19.99'@@ -21245,8 +21766,8 @@ paths:option_type_label: Sizeimage_url:metadata: {}- created_at: '2026-08-06T21:01:37.191Z'- updated_at: '2026-08-06T21:01:37.191Z'+ created_at: '2026-08-07T20:49:28.473Z'+ updated_at: '2026-08-07T20:49:28.473Z'metadata: {}position: 2cost_price: '17.0'@@ -21256,14 +21777,14 @@ paths:dimensions_unit:backorder_limit:deleted_at:- created_at: '2026-08-06T21:01:37.189Z'- updated_at: '2026-08-06T21:01:37.217Z'+ created_at: '2026-08-07T20:49:28.467Z'+ updated_at: '2026-08-07T20:49:28.526Z'preorderable: falsetax_category_id: taxcat_UkLWZg9DAJavailable_stock: 0reserved_quantity: 0total_on_hand: 0- product_name: Product 1013754+ product_name: Product 1011525requestBody:content:application/json:@@ -21508,9 +22029,9 @@ paths:request_errors:response_body:success: false- created_at: '2026-08-06T21:01:37.358Z'- updated_at: '2026-08-06T21:01:37.358Z'- delivered_at: '2026-08-06T21:01:37.358Z'+ created_at: '2026-08-07T20:49:28.656Z'+ updated_at: '2026-08-07T20:49:28.656Z'+ delivered_at: '2026-08-07T20:49:28.656Z'payload:event: order.createddata:@@ -21526,9 +22047,9 @@ paths:request_errors:response_body:success: true- created_at: '2026-08-06T21:01:37.357Z'- updated_at: '2026-08-06T21:01:37.357Z'- delivered_at: '2026-08-06T21:01:37.357Z'+ created_at: '2026-08-07T20:49:28.655Z'+ updated_at: '2026-08-07T20:49:28.655Z'+ delivered_at: '2026-08-07T20:49:28.655Z'payload:event: order.createddata:@@ -21631,9 +22152,9 @@ paths:request_errors:response_body:success: false- created_at: '2026-08-06T21:01:37.490Z'- updated_at: '2026-08-06T21:01:37.490Z'- delivered_at: '2026-08-06T21:01:37.490Z'+ created_at: '2026-08-07T20:49:28.746Z'+ updated_at: '2026-08-07T20:49:28.746Z'+ delivered_at: '2026-08-07T20:49:28.746Z'payload:event: order.createddata:@@ -21722,8 +22243,8 @@ paths:request_errors:response_body:success:- created_at: '2026-08-06T21:01:37.598Z'- updated_at: '2026-08-06T21:01:37.598Z'+ created_at: '2026-08-07T20:49:28.877Z'+ updated_at: '2026-08-07T20:49:28.877Z'delivered_at:payload:event: order.created@@ -21826,8 +22347,8 @@ paths:- order.completed- product.createddisabled_reason:- created_at: '2026-08-06T21:01:37.633Z'- updated_at: '2026-08-06T21:01:37.633Z'+ created_at: '2026-08-07T20:49:28.909Z'+ updated_at: '2026-08-07T20:49:28.909Z'disabled_at:secret_key:last_delivery_at:@@ -21922,10 +22443,10 @@ paths:subscriptions:- order.placeddisabled_reason:- created_at: '2026-08-06T21:01:37.908Z'- updated_at: '2026-08-06T21:01:37.908Z'+ created_at: '2026-08-07T20:49:29.019Z'+ updated_at: '2026-08-07T20:49:29.019Z'disabled_at:- secret_key: e466a546f9ec7bfae23f6946ce4feceeac2743091e425352958e2b88dc2674d0+ secret_key: 12f85dd0db4275f8652ca091c77f6f1de34e7dd884fb504dd63c5d3558d67f21last_delivery_at:recent_delivery_count: 0recent_failure_count: 0@@ -22048,8 +22569,8 @@ paths:- order.completed- product.createddisabled_reason:- created_at: '2026-08-06T21:01:37.991Z'- updated_at: '2026-08-06T21:01:37.991Z'+ created_at: '2026-08-07T20:49:29.102Z'+ updated_at: '2026-08-07T20:49:29.102Z'disabled_at:secret_key:last_delivery_at:@@ -22128,8 +22649,8 @@ paths:- order.completed- product.createddisabled_reason:- created_at: '2026-08-06T21:01:38.135Z'- updated_at: '2026-08-06T21:01:38.172Z'+ created_at: '2026-08-07T20:49:29.180Z'+ updated_at: '2026-08-07T20:49:29.194Z'disabled_at:secret_key:last_delivery_at:@@ -22286,13 +22807,13 @@ paths:request_errors:response_body:success:- created_at: '2026-08-06T21:01:38.445Z'- updated_at: '2026-08-06T21:01:38.445Z'+ created_at: '2026-08-07T20:49:29.371Z'+ updated_at: '2026-08-07T20:49:29.371Z'delivered_at:payload:- id: 9218b093-93cf-4632-b424-b6d399c6ec10+ id: 90f4189d-2e70-443e-a8e2-6c8dab47a027name: webhook.test- created_at: '2026-08-06T21:01:38Z'+ created_at: '2026-08-07T20:49:29Z'data:message: This is a test webhook from Spree.metadata:@@ -22361,8 +22882,8 @@ paths:- order.completed- product.createddisabled_reason:- created_at: '2026-08-06T21:01:38.474Z'- updated_at: '2026-08-06T21:01:38.489Z'+ created_at: '2026-08-07T20:49:29.422Z'+ updated_at: '2026-08-07T20:49:29.439Z'disabled_at:secret_key:last_delivery_at:@@ -22439,9 +22960,9 @@ paths:- order.completed- product.createddisabled_reason: Investigating- created_at: '2026-08-06T21:01:38.520Z'- updated_at: '2026-08-06T21:01:38.537Z'- disabled_at: '2026-08-06T21:01:38.536Z'+ created_at: '2026-08-07T20:49:29.481Z'+ updated_at: '2026-08-07T20:49:29.499Z'+ disabled_at: '2026-08-07T20:49:29.499Z'secret_key:last_delivery_at:recent_delivery_count: 0@@ -22524,8 +23045,8 @@ paths:automatic: falserules_match_policy: allmetadata: {}- created_at: '2026-08-06T21:01:22.681Z'- updated_at: '2026-08-06T21:01:22.681Z'+ created_at: '2026-08-07T20:49:14.959Z'+ updated_at: '2026-08-07T20:49:14.959Z'meta:page: 1limit: 25@@ -22593,8 +23114,8 @@ paths:automatic: truerules_match_policy: anymetadata: {}- created_at: '2026-08-06T21:01:22.734Z'- updated_at: '2026-08-06T21:01:22.736Z'+ created_at: '2026-08-07T20:49:15.089Z'+ updated_at: '2026-08-07T20:49:15.091Z'schema:"$ref": "#/components/schemas/Collection"'422':@@ -22721,8 +23242,8 @@ paths:automatic: falserules_match_policy: allmetadata: {}- created_at: '2026-08-06T21:01:22.784Z'- updated_at: '2026-08-06T21:01:22.784Z'+ created_at: '2026-08-07T20:49:15.135Z'+ updated_at: '2026-08-07T20:49:15.135Z'schema:"$ref": "#/components/schemas/Collection"'404':@@ -22786,8 +23307,8 @@ paths:automatic: falserules_match_policy: allmetadata: {}- created_at: '2026-08-06T21:01:22.846Z'- updated_at: '2026-08-06T21:01:22.868Z'+ created_at: '2026-08-07T20:49:15.181Z'+ updated_at: '2026-08-07T20:49:15.199Z'schema:"$ref": "#/components/schemas/Collection"requestBody:@@ -22962,8 +23483,8 @@ paths:application/json:example:id: prod_UkLWZg9DAJ- name: Product 66252- slug: product-66252+ name: Product 680+ slug: product-680meta_title:meta_description:meta_keywords:@@ -22975,19 +23496,14 @@ paths:in_stock: falsebackorderable: trueavailable: true- description: Et aperiam atque similique quo repellat aliquid totam.- Cupiditate aliquid adipisci iste praesentium a. Dignissimos nisi- mollitia saepe earum hic quasi. Voluptas accusantium cum nisi doloremque- nostrum repellat. Sint distinctio error numquam perferendis saepe- illum rerum repudiandae. Deserunt magnam a nulla ea. Aut sunt voluptates- eum eius corrupti exercitationem doloribus quo. Architecto hic maiores- eaque aliquam. Aliquam iure corrupti magnam similique facilis pariatur.- Facere quo sint praesentium sequi natus tenetur. Est pariatur ut- eius unde totam. Sapiente quasi incidunt corrupti nostrum.- description_html: |-- Et aperiam atque similique quo repellat aliquid totam. Cupiditate aliquid adipisci iste praesentium a. Dignissimos nisi mollitia saepe earum hic quasi. Voluptas accusantium cum nisi doloremque nostrum repellat. Sint distinctio error numquam perferendis saepe illum rerum repudiandae.- Deserunt magnam a nulla ea. Aut sunt voluptates eum eius corrupti exercitationem doloribus quo. Architecto hic maiores eaque aliquam.- Aliquam iure corrupti magnam similique facilis pariatur. Facere quo sint praesentium sequi natus tenetur. Est pariatur ut eius unde totam. Sapiente quasi incidunt corrupti nostrum.+ description: Ea tempore nostrum provident suscipit ab. Incidunt corrupti+ non possimus aliquam dolor repudiandae consequatur nulla. Voluptate+ necessitatibus explicabo ex illo veritatis aspernatur. Facilis fuga+ asperiores quasi impedit soluta vitae.+ description_html: Ea tempore nostrum provident suscipit ab. Incidunt+ corrupti non possimus aliquam dolor repudiandae consequatur nulla.+ Voluptate necessitatibus explicabo ex illo veritatis aspernatur.+ Facilis fuga asperiores quasi impedit soluta vitae.default_variant_id: variant_UkLWZg9DAJthumbnail_url:tags: []@@ -23002,14 +23518,14 @@ paths:display_compare_at_amount:price_list_id:variant_id: variant_UkLWZg9DAJ- created_at: '2026-08-06T21:01:22.964Z'- updated_at: '2026-08-06T21:01:22.964Z'+ created_at: '2026-08-07T20:49:15.281Z'+ updated_at: '2026-08-07T20:49:15.281Z'original_price:status: activemetadata: {}deleted_at:- created_at: '2026-08-06T21:01:22.953Z'- updated_at: '2026-08-06T21:01:22.971Z'+ created_at: '2026-08-07T20:49:15.272Z'+ updated_at: '2026-08-07T20:49:15.285Z'product_type_id:tax_category_id: taxcat_UkLWZg9DAJschema:@@ -23213,16 +23729,16 @@ paths:pickup_point_provider:storefront_visible: truetracking_url:- created_at: '2026-08-06T21:01:24.331Z'- updated_at: '2026-08-06T21:01:24.333Z'+ created_at: '2026-08-07T20:49:16.508Z'+ updated_at: '2026-08-07T20:49:16.509Z'deleted_at:tax_category_id:delivery_zone_ids: []stock_location_ids: []calculator_type: Spree::Calculator::Shipping::FlatRatecalculator_preferences:- amount: '10.0'currency: USD+ amount: '10.0'meta:page: 1limit: 25@@ -23293,16 +23809,16 @@ paths:pickup_point_provider:storefront_visible: truetracking_url:- created_at: '2026-08-06T21:01:24.384Z'- updated_at: '2026-08-06T21:01:24.385Z'+ created_at: '2026-08-07T20:49:16.552Z'+ updated_at: '2026-08-07T20:49:16.553Z'deleted_at:tax_category_id:delivery_zone_ids: []stock_location_ids: []calculator_type: Spree::Calculator::Shipping::FlatRatecalculator_preferences:- amount: '12.5'currency: USD+ amount: '12.5'requestBody:content:application/json:@@ -23408,15 +23924,18 @@ paths:- type: Spree::Calculator::Shipping::FlatRatename: Flat ratepreference_schema:- - key: amount- type: decimal- default: 0- key: currencytype: stringdefault: USD+ - key: amount+ type: decimal+ default: 0- type: Spree::Calculator::Shipping::FlexiRatename: Flexible Rate per package itempreference_schema:+ - key: currency+ type: string+ default: USD- key: first_itemtype: decimaldefault: 0.0@@ -23426,42 +23945,39 @@ paths:- key: max_itemstype: integerdefault: 0- - key: currency- type: string- default: USD- type: Spree::Calculator::Shipping::PerItemname: Flat rate per package itempreference_schema:- - key: amount- type: decimal- default: 0- key: currencytype: stringdefault: USD+ - key: amount+ type: decimal+ default: 0- type: Spree::Calculator::Shipping::PriceSackname: Price sackpreference_schema:- - key: minimal_amount+ - key: currency+ type: string+ default: USD+ - key: discount_amounttype: decimaldefault: 0- - key: normal_amount+ - key: minimal_amounttype: decimaldefault: 0- - key: discount_amount+ - key: normal_amounttype: decimaldefault: 0- - key: currency- type: string- default: USD- type: Spree::Calculator::Shipping::DigitalDeliveryname: Digital Deliverypreference_schema:- - key: amount- type: decimal- default: 0- key: currencytype: stringdefault: USD+ - key: amount+ type: decimal+ default: 0"/api/v3/admin/delivery_zones":post:summary: Create delivery zone@@ -23530,8 +24046,8 @@ paths:country_iso: USstate_abbr:state_name:- created_at: '2026-08-06T21:01:24.451Z'- updated_at: '2026-08-06T21:01:24.451Z'+ created_at: '2026-08-07T20:49:16.611Z'+ updated_at: '2026-08-07T20:49:16.611Z'- id: dzm_gbHJdmfrXBmember_type: postal_codepostal_code_prefix: '10'@@ -23540,10 +24056,10 @@ paths:country_iso: USstate_abbr:state_name:- created_at: '2026-08-06T21:01:24.451Z'- updated_at: '2026-08-06T21:01:24.451Z'- created_at: '2026-08-06T21:01:24.450Z'- updated_at: '2026-08-06T21:01:24.450Z'+ created_at: '2026-08-07T20:49:16.611Z'+ updated_at: '2026-08-07T20:49:16.611Z'+ created_at: '2026-08-07T20:49:16.610Z'+ updated_at: '2026-08-07T20:49:16.610Z'delivery_method_ids: []requestBody:content:@@ -23641,8 +24157,8 @@ paths:fulfillment_types:- shippingproducts_count: 0- created_at: '2026-08-06T21:01:33.302Z'- updated_at: '2026-08-06T21:01:33.302Z'+ created_at: '2026-08-07T20:49:24.637Z'+ updated_at: '2026-08-07T20:49:24.637Z'option_type_ids: []category_ids: []custom_field_definitions: []@@ -23718,8 +24234,8 @@ paths:fulfillment_types:- shippingproducts_count: 0- created_at: '2026-08-06T21:01:33.368Z'- updated_at: '2026-08-06T21:01:33.368Z'+ created_at: '2026-08-07T20:49:24.687Z'+ updated_at: '2026-08-07T20:49:24.687Z'option_type_ids: []category_ids: []custom_field_definitions: []@@ -23821,8 +24337,8 @@ paths:fulfillment_types:- shippingproducts_count: 0- created_at: '2026-08-06T21:01:33.400Z'- updated_at: '2026-08-06T21:01:33.400Z'+ created_at: '2026-08-07T20:49:24.729Z'+ updated_at: '2026-08-07T20:49:24.729Z'option_type_ids: []category_ids: []custom_field_definitions: []@@ -23876,8 +24392,8 @@ paths:fulfillment_types:- shippingproducts_count: 0- created_at: '2026-08-06T21:01:33.446Z'- updated_at: '2026-08-06T21:01:33.464Z'+ created_at: '2026-08-07T20:49:24.774Z'+ updated_at: '2026-08-07T20:49:24.789Z'option_type_ids: []category_ids: []custom_field_definitions: []@@ -27327,6 +27843,32 @@ components:- created_at- updated_atx-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: truePriceHistory:type: objectproperties:@@ -28209,15 +28751,30 @@ components:type: stringname:type: string+ description:+ type: string+ nullable: truecreated_at:type: stringupdated_at:type: string+ permissions:+ type: array+ items:+ type: string+ mutable:+ type: boolean+ users_count:+ type: numberrequired:- id- name+ - description- created_at- updated_at+ - permissions+ - mutable+ - users_countx-typelizer: trueSetupTask:type: objectdiff --git a/docs/api-reference/store.yaml b/docs/api-reference/store.yamlindex 49dfa6ebd8..0186dfb184 100644--- a/docs/api-reference/store.yaml+++ b/docs/api-reference/store.yaml@@ -87,16 +87,16 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjRjN2VkNTM1LTFkMjAtNDQyZS05NWUwLTJkZDdjZDA0NmVjNSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2MDAyNzgzfQ.O5_jPB0rDvMkk20QUn8rnNULTA7OAfIeJqE9f7O2fxE- refresh_token: 7tSX6C2f9EEhZPLmGYxBf6d8+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjFmNDgxZjc4LTVkMDAtNDc5Yy05ZTAwLWMwMjMxOTUxNDE4NSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2MTM5MzY5fQ.jKLlQNyWPaA2UgqZj6li3jjM8nRVnrnWNh__KE-9fk4+ refresh_token: qjAnvpPQjuz7UrwsxJYNGewBuser:id: cust_UkLWZg9DAJemail: [email protected]- first_name: Bruce- last_name: Waters+ first_name: Tanesha+ last_name: Shieldsphone:accepts_email_marketing: false- full_name: Bruce Waters+ full_name: Tanesha Shieldsavailable_store_credit_total: '0'display_available_store_credit_total: "$0.00"addresses: []@@ -194,16 +194,16 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjI2MzhlOGNkLTI0MzMtNGRmMS04YWQ2LTYwZjM3NTE1YjU4MSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2MDAyNzgzfQ.9ytKHVG2ef_TDxL_-BjDlerI2jxMEkhg2QBcosWM1t4- refresh_token: v3ThBkwXcfXLostRSTk21mc2+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjQxZTk0YjJlLTFjMjAtNDg2My1hYzhiLTlmYTFkZGVkYTJkYyIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2MTM5MzY5fQ.Pq5lymxSNudXHZJfj7XX8vhaHhUEwe1n2qNENJS7lMM+ refresh_token: AtCKZc6PqsRqykRq7DWkJ3Lguser:id: cust_UkLWZg9DAJemail: [email protected]- first_name: Margie- last_name: Schmidt+ first_name: Kirk+ last_name: Beerphone:accepts_email_marketing: false- full_name: Margie Schmidt+ full_name: Kirk Beeravailable_store_credit_total: '0'display_available_store_credit_total: "$0.00"addresses: []@@ -393,16 +393,16 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImNiYjFjYjMyLTU1NmEtNDViMC05Y2I3LTNjNzMwYmQzYTE4ZiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2MDAyNzg2fQ.6iCKOqevqdXLuqaW9dtjcmX1IVkX9MYcKKjNlWamAR0- refresh_token: z8mdjRLpth3e87ghDD3ViW4o+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImZiZDU5MDJkLTYxZDktNDVmYi1iZjJkLWVmOWVkZTM0YzQzMyIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2MTM5MzcyfQ.hOpEfn34eDzhNsE1tVV6LHYtugyzkf6AVR_3dSvT2RM+ refresh_token: EUv7LL2a8fwFjeA8nzTw56oLuser:id: cust_UkLWZg9DAJemail: [email protected]- first_name: Kimbery- last_name: Larkin+ first_name: Edwardo+ last_name: Hermannphone:accepts_email_marketing: false- full_name: Kimbery Larkin+ full_name: Edwardo Hermannavailable_store_credit_total: '0'display_available_store_credit_total: "$0.00"addresses: []@@ -879,8 +879,8 @@ paths:example:data:- id: prod_UkLWZg9DAJ- name: Product 1297032- slug: product-1297032+ name: Product 1291343+ slug: product-1291343meta_title:meta_description:meta_keywords:@@ -892,29 +892,20 @@ paths:in_stock: falsebackorderable: trueavailable: true- description: Corporis fugit culpa ad magni sit doloremque pariatur.- Natus earum deleniti distinctio quaerat voluptatum eaque. Culpa- inventore tempora voluptatem id enim reprehenderit. Amet veniam- magnam temporibus harum. Aperiam minima magnam beatae ad. Ab praesentium- nostrum accusantium magni nihil quod quo. Rerum aperiam quidem- mollitia incidunt autem temporibus. Eaque iure eligendi laudantium- tempore iusto nemo. Officiis ut tempore dolor architecto fugiat- ullam. Corporis architecto eum molestiae provident recusandae- modi. Dolore neque id deserunt ut similique officiis. Nostrum- fugiat ut veniam perferendis ullam laborum. Repellendus adipisci- similique fugiat ut doloribus cum. Nihil ipsum nulla necessitatibus- voluptatum expedita debitis at. Pariatur adipisci itaque hic autem- soluta quo debitis. Cupiditate provident deserunt sequi perferendis- laboriosam maiores officiis placeat. Impedit atque magnam similique- minus necessitatibus harum consectetur. Soluta asperiores nisi- temporibus natus ratione repellat. Asperiores provident laborum- est voluptates.+ description: Nisi minima quis deleniti quam blanditiis possimus.+ At nihil quis deleniti ratione illum molestiae. Repudiandae quibusdam+ reprehenderit magnam odit. Praesentium commodi unde incidunt porro.+ Cupiditate nam sit architecto error natus. Ex enim tempore quibusdam+ praesentium adipisci est recusandae. Inventore excepturi eveniet+ assumenda aliquid. Reiciendis quos ipsam nesciunt quas eaque accusantium.+ Optio recusandae porro saepe id repellat dicta officiis. Quam+ qui ex sit rerum quasi placeat vitae veritatis. Blanditiis ratione+ excepturi recusandae culpa eum consectetur impedit. Magni odit+ nobis cum ipsum cumque voluptates.description_html: |-- Corporis fugit culpa ad magni sit doloremque pariatur. Natus earum deleniti distinctio quaerat voluptatum eaque. Culpa inventore tempora voluptatem id enim reprehenderit.- Amet veniam magnam temporibus harum. Aperiam minima magnam beatae ad. Ab praesentium nostrum accusantium magni nihil quod quo. Rerum aperiam quidem mollitia incidunt autem temporibus. Eaque iure eligendi laudantium tempore iusto nemo.- Officiis ut tempore dolor architecto fugiat ullam. Corporis architecto eum molestiae provident recusandae modi. Dolore neque id deserunt ut similique officiis. Nostrum fugiat ut veniam perferendis ullam laborum.- Repellendus adipisci similique fugiat ut doloribus cum. Nihil ipsum nulla necessitatibus voluptatum expedita debitis at. Pariatur adipisci itaque hic autem soluta quo debitis. Cupiditate provident deserunt sequi perferendis laboriosam maiores officiis placeat.- Impedit atque magnam similique minus necessitatibus harum consectetur. Soluta asperiores nisi temporibus natus ratione repellat. Asperiores provident laborum est voluptates.+ Nisi minima quis deleniti quam blanditiis possimus. At nihil quis deleniti ratione illum molestiae. Repudiandae quibusdam reprehenderit magnam odit.+ Praesentium commodi unde incidunt porro. Cupiditate nam sit architecto error natus. Ex enim tempore quibusdam praesentium adipisci est recusandae. Inventore excepturi eveniet assumenda aliquid. Reiciendis quos ipsam nesciunt quas eaque accusantium.+ Optio recusandae porro saepe id repellat dicta officiis. Quam qui ex sit rerum quasi placeat vitae veritatis. Blanditiis ratione excepturi recusandae culpa eum consectetur impedit. Magni odit nobis cum ipsum cumque voluptates.default_variant_id: variant_UkLWZg9DAJthumbnail_url:tags: []@@ -1069,8 +1060,8 @@ paths:example:data:- id: prod_UkLWZg9DAJ- name: Product 1717074- slug: product-1717074+ name: Product 1717378+ slug: product-1717378meta_title:meta_description:meta_keywords:@@ -1099,8 +1090,8 @@ paths:price_list_id:original_price:- id: prod_gbHJdmfrXB- name: Product 1726982- slug: product-1726982+ name: Product 1723546+ slug: product-1723546meta_title:meta_description:meta_keywords:@@ -1112,27 +1103,31 @@ paths:in_stock: falsebackorderable: trueavailable: true- description: Nihil possimus consequuntur illum adipisci. Corrupti- ea earum sunt repellendus magnam soluta assumenda. Numquam consequuntur- tenetur veritatis sequi optio ad. Repellendus tempore officiis- perferendis hic voluptatum illo odit. Non blanditiis perspiciatis- aliquam dicta ut perferendis debitis. Explicabo quibusdam neque- sit ipsam officia. Praesentium maiores perspiciatis corporis autem- soluta incidunt placeat. Ea repellendus ad deserunt ullam inventore- repudiandae aliquid natus. Optio voluptatum aliquid officia debitis- enim. Nulla provident eius magni quasi iste odit culpa. Animi- consequatur quae laboriosam nihil nisi molestiae. Ipsam explicabo- ipsum deserunt sunt. Dolorum voluptatum non qui magnam. Quasi- culpa vero praesentium cupiditate illum omnis. Doloribus iure- ipsum aspernatur harum non. Adipisci esse eaque dolores natus- veritatis consequuntur delectus quas. Quam doloremque architecto- blanditiis accusantium magni. Perspiciatis quod rem dignissimos- veritatis. Adipisci provident veniam incidunt perferendis.+ description: Iure velit nisi consequatur inventore vel esse commodi.+ Aut cupiditate maxime debitis nesciunt. Ipsa ipsam nihil asperiores+ repellat voluptatibus. Voluptas eos fuga iste accusantium fugit+ dolore. Facilis nobis saepe sunt sed recusandae et rerum. Quidem+ sint perferendis nemo dolorum magni aut similique. Consequatur+ praesentium est cum recusandae quibusdam quod ea. Dolore quaerat+ vero saepe placeat nobis assumenda totam neque. Aperiam sequi+ saepe maxime ea blanditiis quas. Numquam autem neque fugiat libero+ dolore. Cum soluta mollitia quam possimus. Quae a aliquid excepturi+ accusantium maiores. Distinctio at dolores voluptates iste consequuntur+ molestiae fugit aliquid. Quisquam autem officiis possimus provident.+ Ab consequuntur magnam et placeat ducimus dolor aut. Nemo modi+ quidem incidunt accusamus aut exercitationem. At deleniti doloremque+ tempora sunt culpa qui nesciunt. Unde culpa dolorem ducimus autem+ quaerat id. Aliquid cupiditate vero doloribus at quidem quisquam.+ Corporis optio iste nesciunt qui velit nemo corrupti. Dolores+ maiores voluptatem rem nemo ullam esse. Beatae minus in libero+ doloribus quasi quia provident nisi. Nesciunt corrupti voluptatem+ commodi aliquam amet id.description_html: |-- Nihil possimus consequuntur illum adipisci. Corrupti ea earum sunt repellendus magnam soluta assumenda. Numquam consequuntur tenetur veritatis sequi optio ad. Repellendus tempore officiis perferendis hic voluptatum illo odit. Non blanditiis perspiciatis aliquam dicta ut perferendis debitis.- Explicabo quibusdam neque sit ipsam officia. Praesentium maiores perspiciatis corporis autem soluta incidunt placeat. Ea repellendus ad deserunt ullam inventore repudiandae aliquid natus. Optio voluptatum aliquid officia debitis enim.- Nulla provident eius magni quasi iste odit culpa. Animi consequatur quae laboriosam nihil nisi molestiae. Ipsam explicabo ipsum deserunt sunt. Dolorum voluptatum non qui magnam. Quasi culpa vero praesentium cupiditate illum omnis.- Doloribus iure ipsum aspernatur harum non. Adipisci esse eaque dolores natus veritatis consequuntur delectus quas. Quam doloremque architecto blanditiis accusantium magni. Perspiciatis quod rem dignissimos veritatis. Adipisci provident veniam incidunt perferendis.+ Iure velit nisi consequatur inventore vel esse commodi. Aut cupiditate maxime debitis nesciunt. Ipsa ipsam nihil asperiores repellat voluptatibus. Voluptas eos fuga iste accusantium fugit dolore. Facilis nobis saepe sunt sed recusandae et rerum.+ Quidem sint perferendis nemo dolorum magni aut similique. Consequatur praesentium est cum recusandae quibusdam quod ea. Dolore quaerat vero saepe placeat nobis assumenda totam neque. Aperiam sequi saepe maxime ea blanditiis quas. Numquam autem neque fugiat libero dolore.+ Cum soluta mollitia quam possimus. Quae a aliquid excepturi accusantium maiores. Distinctio at dolores voluptates iste consequuntur molestiae fugit aliquid. Quisquam autem officiis possimus provident.+ Ab consequuntur magnam et placeat ducimus dolor aut. Nemo modi quidem incidunt accusamus aut exercitationem. At deleniti doloremque tempora sunt culpa qui nesciunt. Unde culpa dolorem ducimus autem quaerat id.+ Aliquid cupiditate vero doloribus at quidem quisquam. Corporis optio iste nesciunt qui velit nemo corrupti. Dolores maiores voluptatem rem nemo ullam esse. Beatae minus in libero doloribus quasi quia provident nisi. Nesciunt corrupti voluptatem commodi aliquam amet id.default_variant_id: variant_EfhxLZ9ck8thumbnail_url:tags: []@@ -1234,8 +1229,8 @@ paths:application/json:example:id: prod_UkLWZg9DAJ- name: Product 1999987- slug: product-1999987+ name: Product 1996315+ slug: product-1996315meta_title:meta_description:meta_keywords:@@ -1269,7 +1264,7 @@ paths:amount_in_cents: 999currency: USDdisplay_amount: "$9.99"- recorded_at: '2026-07-22T06:53:12Z'+ recorded_at: '2026-07-23T20:49:39Z'schema:"$ref": "#/components/schemas/Product"'404':@@ -1519,7 +1514,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_gbHJdmfrXB- token: vY7vPHCKPmddDqkMsueQnDnS+ token: ZGwRfzzwTM1QZDmG1fCs2aJ5email:customer_note:currency: USD@@ -1578,8 +1573,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1048664- slug: product-1048664+ name: Product 1048908+ slug: product-1048908options_text: ''price: '10.0'display_price: "$10.00"@@ -1624,7 +1619,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: YF5RiUAJDyB6sPeyFmpfjj9Q+ token: rDJKdfw23YF2LXwEZjM8f7wJemail:customer_note:currency: USD@@ -1683,8 +1678,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1039063- slug: product-1039063+ name: Product 1034202+ slug: product-1034202options_text: ''price: '10.0'display_price: "$10.00"@@ -1802,7 +1797,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: BjNncg9bJwpfz9BsWKE51dNs+ token: JTsY1USfmyF6pnH4EdMwN7DCemail:customer_note:currency: USD@@ -1967,7 +1962,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: gH9hRoksSuMR9qrLxeV5LipU+ token: JJytHbVGaseU1BVd1DEAKpFzemail:customer_note:currency: USD@@ -1975,7 +1970,7 @@ paths:total_quantity: 0warnings:- code: line_item_removed- message: Product 1085606 was removed because it was sold out+ message: Product 1086790 was removed because it was sold outline_item_id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJcoupon_code:@@ -2117,7 +2112,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: BNTmJyhhfHdQxYBBJkTiX6u9+ token: ssiwdnYqtCKnFAHqAX7ZoeSUemail:customer_note: Leave at doorcurrency: USD@@ -2172,8 +2167,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1093203- slug: product-1093203+ name: Product 1095813+ slug: product-1095813options_text: ''price: '10.0'display_price: "$10.00"@@ -2392,8 +2387,8 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: Z3jeSEhH4y5aXSvbwYHzVANy- email: [email protected]+ token: 5vrdx2ikeKAv3d7fJfhwbjat+ email: [email protected]customer_note:currency: USDlocale: en@@ -2444,8 +2439,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1119378- slug: product-1119378+ name: Product 1115530+ slug: product-1115530options_text: ''price: '10.0'display_price: "$10.00"@@ -2599,8 +2594,8 @@ paths:market_id: mkt_UkLWZg9DAJcart_id: cart_UkLWZg9DAJchannel_id: ch_UkLWZg9DAJ- number: R771964763- email: [email protected]+ number: R690497072+ email: [email protected]customer_note:currency: USDlocale: en@@ -2608,7 +2603,7 @@ paths:coupon_code:fulfillment_status: backorderpayment_status: paid- completed_at: '2026-08-06T06:53:04.144Z'+ completed_at: '2026-08-07T20:49:30.670Z'item_total: '10.0'display_item_total: "$10.00"adjustment_total: '0.0'@@ -2640,8 +2635,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1141752- slug: product-1141752+ name: Product 1144047+ slug: product-1144047options_text: ''price: '10.0'display_price: "$10.00"@@ -2666,7 +2661,7 @@ paths:digital_links: []fulfillments:- id: ful_gbHJdmfrXB- number: F77291293587+ number: F39480379632tracking:tracking_url:pickup_point_data:@@ -2700,7 +2695,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: NY- name: Armanda Senger+ name: Trinidad Weissnataddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -2732,8 +2727,8 @@ paths:payments:- id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJ- response_code: BGS-fc8fac9944b9- number: PAWX9EMK+ response_code: BGS-ea4603e066c1+ number: PUOJEYV0amount: '20.0'display_amount: "$20.00"status: completed@@ -2889,7 +2884,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: ky57Uzbs9RduSQJfDrmYsd9y+ token: FQDbauG8aEgScLYUcXpMkPpMemail:customer_note:currency: USD@@ -2947,8 +2942,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1402745- slug: product-1402745+ name: Product 1405795+ slug: product-1405795options_text: ''price: '10.0'display_price: "$10.00"@@ -3077,7 +3072,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: ZH3qUqoa5mFPx8KVGwZtu3Cn+ token: tAv724h9v1PwxK1V9ieHCqMHemail:customer_note:currency: USD@@ -3132,8 +3127,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 142939- slug: product-142939+ name: Product 1426794+ slug: product-1426794options_text: ''price: '10.0'display_price: "$10.00"@@ -3251,8 +3246,8 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: uVu1rkCULSJyvZHCG3zPsnT5- email: [email protected]+ token: tfZdN3Upa8rmmMr4rUQ5SBSC+ email: [email protected]customer_note:currency: USDlocale: en@@ -3300,8 +3295,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1449771- slug: product-1449771+ name: Product 1446727+ slug: product-1446727options_text: ''price: '10.0'display_price: "$10.00"@@ -3326,7 +3321,7 @@ paths:digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: F29595870834+ number: F54133936901tracking:tracking_url:pickup_point_data:@@ -3360,7 +3355,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: NY- name: Catherin Herman+ name: Oren Carrolladdress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -3515,7 +3510,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: V68JRRRdxiK4hs2SBoFsKkbv+ token: TMvtwbyRwVToyVreqaaQV8Ztemail:customer_note:currency: USD@@ -3566,8 +3561,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1463654- slug: product-1463654+ name: Product 1469145+ slug: product-1469145options_text: ''price: '10.0'display_price: "$10.00"@@ -3594,8 +3589,8 @@ paths:payments:- id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJ- response_code: 1-SC-20260806065308243546- number: PDA34NFS+ response_code: 1-SC-20260807204934590829+ number: P9BMZ97Yamount: '10.0'display_amount: "$10.00"status: checkout@@ -3751,7 +3746,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: FcUFveqkBY96UnuYEoFmXeWt+ token: MXpyX5n3idPNTt2vofWnZdyEemail:customer_note:currency: USD@@ -3806,8 +3801,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1507634- slug: product-1507634+ name: Product 1505234+ slug: product-1505234options_text: ''price: '10.0'display_price: "$10.00"@@ -3834,8 +3829,8 @@ paths:payments:- id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJ- response_code: 1-SC-20260806065308550221- number: P5O2YNFO+ response_code: 1-SC-20260807204934865762+ number: PIED5HX1amount: '10.0'display_amount: "$10.00"status: invalid@@ -3942,7 +3937,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: 21dV9iF7HCyJ9TZc27BRs9sJ+ token: jvadFhxXvhEg16NhkUmoibCqemail:customer_note:currency: USD@@ -3950,10 +3945,10 @@ paths:total_quantity: 2warnings:- code: delivery_unavailable- message: Product 1535829 cannot be delivered to the selected address+ message: Product 1533090 cannot be delivered to the selected addressline_item_id: li_UkLWZg9DAJ- code: delivery_unavailable- message: Product 1544634 cannot be delivered to the selected address+ message: Product 1545235 cannot be delivered to the selected addressline_item_id: li_gbHJdmfrXBcoupon_code:item_total: '29.99'@@ -4003,8 +3998,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1535829- slug: product-1535829+ name: Product 1533090+ slug: product-1533090options_text: ''price: '10.0'display_price: "$10.00"@@ -4033,8 +4028,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1544634- slug: product-1544634+ name: Product 1545235+ slug: product-1545235options_text: ''price: '19.99'display_price: "$19.99"@@ -4172,7 +4167,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: wWk1EgsJzsbmN3K9grajefro+ token: uUckmDmEqhr6E3DnFTEvFzzyemail:customer_note:currency: USD@@ -4223,8 +4218,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 157938- slug: product-157938+ name: Product 157324+ slug: product-157324options_text: ''price: '10.0'display_price: "$10.00"@@ -4342,7 +4337,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: yQ9xoEFyHZ2Pxr6ZLBa9Q8Jq+ token: Q8cbePWDHEjRhPzo6S4byoyRemail:customer_note:currency: USD@@ -4482,9 +4477,9 @@ paths:id: ps_gbHJdmfrXBstatus: pendingcurrency: USD- external_id: bogus_9a7451b93a3688b86e94e0c0+ external_id: bogus_da5aecdce2f1f7c90d576255external_data:- client_secret: bogus_secret_c6a19ce2f31f91fc+ client_secret: bogus_secret_806b4e9099a5c035customer_external_id:expires_at:amount: '10.0'@@ -4583,7 +4578,7 @@ paths:id: ps_UkLWZg9DAJstatus: pendingcurrency: USD- external_id: bogus_d8d0ce9db3686d9ed687a59e+ external_id: bogus_77cff91ae222d5fad98b608dexternal_data:client_secret: secret_123customer_external_id:@@ -4646,7 +4641,7 @@ paths:id: ps_UkLWZg9DAJstatus: pendingcurrency: USD- external_id: bogus_048aa8b3eef1d42ca5646333+ external_id: bogus_191a50d17dc7ebcc9bb4fd1aexternal_data:client_secret: secret_123customer_external_id:@@ -4749,7 +4744,7 @@ paths:id: ps_UkLWZg9DAJstatus: completedcurrency: USD- external_id: bogus_eb6a543a69de2d6c8f5e2d2d+ external_id: bogus_25cb72f4dc3b5f94c8a8e7a8external_data:client_secret: secret_123customer_external_id:@@ -4848,7 +4843,7 @@ paths:id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJresponse_code:- number: PENIW5RF+ number: PGHI0N2Famount: '10.0'display_amount: "$10.00"status: checkout@@ -4957,7 +4952,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: 4sMuM9pXGSrH8LTxJVvaqpg2+ token: MGL861esQxkfKMERy5R6Hu9oemail:customer_note:currency: USD@@ -5008,8 +5003,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 2199064- slug: product-2199064+ name: Product 2199602+ slug: product-2199602options_text: ''price: '10.0'display_price: "$10.00"@@ -5036,8 +5031,8 @@ paths:payments:- id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJ- response_code: 1-SC-20260806065314214085- number: PC4HV7M9+ response_code: 1-SC-20260807204940420175+ number: PTUTDCC0amount: '10.0'display_amount: "$10.00"status: checkout@@ -5157,7 +5152,7 @@ paths:channel_id: ch_UkLWZg9DAJpreferred_stock_location_id:number: cart_UkLWZg9DAJ- token: eXmqiv8HzsoRXHhJCyHxwPEg+ token: DKVofW1AeXvnPu4zmnbpPBYjemail:customer_note:currency: USD@@ -5212,8 +5207,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 2211750- slug: product-2211750+ name: Product 2217255+ slug: product-2217255options_text: ''price: '10.0'display_price: "$10.00"@@ -5328,7 +5323,7 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R553866761+ number: R998302679email: [email protected]customer_note:currency: USD@@ -5337,7 +5332,7 @@ paths:coupon_code:fulfillment_status:payment_status:- completed_at: '2026-08-06T06:53:10.319Z'+ completed_at: '2026-08-07T20:49:36.532Z'item_total: '10.0'display_item_total: "$10.00"adjustment_total: '0.0'@@ -5369,8 +5364,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1618277- slug: product-1618277+ name: Product 1619033+ slug: product-1619033options_text: ''price: '10.0'display_price: "$10.00"@@ -5395,7 +5390,7 @@ paths:digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: F33598649535+ number: F63949833773tracking: U10000tracking_url:pickup_point_data:@@ -5429,7 +5424,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: NY- name: Ulrike Dach+ name: Melodi Franeckiaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -6381,8 +6376,8 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R849832793- email: [email protected]+ number: R074347320+ email: [email protected]customer_note:currency: USDlocale: en@@ -6390,7 +6385,7 @@ paths:coupon_code:fulfillment_status:payment_status:- completed_at: '2026-08-06T06:53:06.652Z'+ completed_at: '2026-08-07T20:49:33.026Z'item_total: '10.0'display_item_total: "$10.00"adjustment_total: '0.0'@@ -6422,8 +6417,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 1309181- slug: product-1309181+ name: Product 1308646+ slug: product-1308646options_text: ''price: '10.0'display_price: "$10.00"@@ -6448,7 +6443,7 @@ paths:digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: F89983461451+ number: F19402681403tracking: U10000tracking_url:pickup_point_data:@@ -6482,7 +6477,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: NY- name: Jolanda Moen+ name: Sharen Beckeraddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -6659,8 +6654,8 @@ paths:market_id: mkt_UkLWZg9DAJcart_id:channel_id: ch_UkLWZg9DAJ- number: R289935921- email: [email protected]+ number: R660891710+ email: [email protected]customer_note:currency: USDlocale: en@@ -6668,7 +6663,7 @@ paths:coupon_code:fulfillment_status:payment_status:- completed_at: '2026-08-06T06:53:06.819Z'+ completed_at: '2026-08-07T20:49:33.255Z'item_total: '10.0'display_item_total: "$10.00"adjustment_total: '0.0'@@ -6700,8 +6695,8 @@ paths:preorder_ships_at:quantity: 1currency: USD- name: Product 132878- slug: product-132878+ name: Product 1325941+ slug: product-1325941options_text: ''price: '10.0'display_price: "$10.00"@@ -6726,7 +6721,7 @@ paths:digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: F69709338407+ number: F42518993200tracking: U10000tracking_url:pickup_point_data:@@ -6760,7 +6755,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: NY- name: Enriqueta Ziemann+ name: Larraine Hahnaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -6893,8 +6888,8 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImNhMjJmOGIwLTQ1ZGMtNGIyOS1hMGFiLWEzZTY4YWJhZjUxYSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2MDAyNzg2fQ.h2PO2I5UVwVUO7z-M4F4IKFSvSnRgsbG76DGrJceurM- refresh_token: yQ4wuoebHJSWeuNwPiZGeHVh+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjAwOWJjZjAzLTAyNzAtNDA1NS05OTYzLTdlNDYzZTJkMzg0ZSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzg2MTM5MzczfQ.YWm3T24sBmwnQpIgElqnyc2iBeU6W5ny4xHUuXEF5wY+ refresh_token: caQWisav2V1qfuqpfvn3qPyhuser:id: cust_UkLWZg9DAJemail: [email protected]@@ -6911,10 +6906,10 @@ paths:newsletter_subscriber:id: sub_UkLWZg9DAJemail: [email protected]- created_at: '2026-08-06T06:53:06.975Z'- updated_at: '2026-08-06T06:53:06.976Z'+ created_at: '2026-08-07T20:49:33.404Z'+ updated_at: '2026-08-07T20:49:33.406Z'verified: true- verified_at: '2026-08-06T06:53:06Z'+ verified_at: '2026-08-07T20:49:33Z'customer_id: cust_UkLWZg9DAJcustomer_groups: []schema:@@ -7017,12 +7012,12 @@ paths:application/json:example:id: cust_UkLWZg9DAJ- email: [email protected]- first_name: Alonzo- last_name: Volkman+ email: [email protected]+ first_name: Rochelle+ last_name: Champlinphone: 555-555-0199accepts_email_marketing: false- full_name: Alonzo Volkman+ full_name: Rochelle Champlinavailable_store_credit_total: '0'display_available_store_credit_total: "$0.00"addresses:@@ -7158,7 +7153,7 @@ paths:application/json:example:id: cust_UkLWZg9DAJ- email: [email protected]+ email: [email protected]first_name: Updatedlast_name: Namephone: 555-555-0199@@ -7349,7 +7344,7 @@ paths:example:data:- id: gc_UkLWZg9DAJ- code: 9D3B1152FA1EBBC7+ code: AF6F27B34CA326B8status: activecurrency: USDamount: '10.0'@@ -7445,7 +7440,7 @@ paths:application/json:example:id: gc_UkLWZg9DAJ- code: 056F7633DFC7D0A2+ code: 0006045EDC4130B7status: activecurrency: USDamount: '10.0'@@ -7517,8 +7512,8 @@ paths:example:id: pss_gbHJdmfrXBstatus: pending- external_id: bogus_seti_1fe26750bf32c78ae9c78fdf- external_client_secret: bogus_seti_secret_8fbfc2b8555025bd+ external_id: bogus_seti_06e37be8d870c452be8085da+ external_client_secret: bogus_seti_secret_b234c3ea512af9ccexternal_data: {}payment_method_id: pm_UkLWZg9DAJpayment_source_id:@@ -7617,8 +7612,8 @@ paths:example:id: pss_UkLWZg9DAJstatus: pending- external_id: seti_test_841b582d4f46c6e668f0a19e- external_client_secret: seti_secret_2b80ae9839b0e71a6c5b4e22+ external_id: seti_test_42391fd9fa4a73438ae05dea+ external_client_secret: seti_secret_0bea7b367249088c1152c923external_data:client_secret: secret_123payment_method_id: pm_UkLWZg9DAJ@@ -7694,8 +7689,8 @@ paths:example:id: pss_UkLWZg9DAJstatus: completed- external_id: seti_test_c9eebd4de27894b5e817de7c- external_client_secret: seti_secret_33ca80adc19901ba5b13b015+ external_id: seti_test_e8ee2d846b185a5d8e969db6+ external_client_secret: seti_secret_fb416451aae79dd1d04b6558external_data:client_secret: secret_123payment_method_id: pm_UkLWZg9DAJ@@ -8639,7 +8634,7 @@ paths:data:- id: wl_UkLWZg9DAJname: My Wishlist- token: ZKig6aVWNDEc98vpNp9ovq37+ token: cCfcGuXqgQmyvAthWzsaQb8Ris_default: falseis_private: truemeta:@@ -8715,7 +8710,7 @@ paths:example:id: wl_gbHJdmfrXBname: Birthday Ideas- token: kiA4acRfkf4qvsWzCmLDFAkf+ token: LFUSYaoFAnedbWDoC28moiU3is_default: falseis_private: trueschema:@@ -8816,7 +8811,7 @@ paths:example:id: wl_UkLWZg9DAJname: My Wishlist- token: jDyQvCE5UJ9Vr4jf94BeRthm+ token: K8VuQB6TFgLUiV5MYMmTZfVKis_default: falseis_private: trueschema:@@ -8878,7 +8873,7 @@ paths:example:id: wl_UkLWZg9DAJname: Updated Name- token: wRHy3dCZJ23whZsVZVdU6XG9+ token: 5EDZVQqMcUZ5mdbtxJAm4qYVis_default: falseis_private: trueschema:@@ -9160,11 +9155,11 @@ paths:application/json:example:id: sub_UkLWZg9DAJ- email: [email protected]- created_at: '2026-08-06T06:53:09.759Z'- updated_at: '2026-08-06T06:53:09.760Z'+ email: [email protected]+ created_at: '2026-08-07T20:49:35.983Z'+ updated_at: '2026-08-07T20:49:35.984Z'verified: true- verified_at: '2026-08-06T06:53:09Z'+ verified_at: '2026-08-07T20:49:35Z'customer_id: cust_UkLWZg9DAJschema:"$ref": "#/components/schemas/NewsletterSubscriber"@@ -9243,10 +9238,10 @@ paths:example:id: sub_UkLWZg9DAJemail: [email protected]- created_at: '2026-08-06T06:53:09.780Z'- updated_at: '2026-08-06T06:53:09.785Z'+ created_at: '2026-08-07T20:49:36.006Z'+ updated_at: '2026-08-07T20:49:36.011Z'verified: true- verified_at: '2026-08-06T06:53:09Z'+ verified_at: '2026-08-07T20:49:36Z'customer_id:schema:"$ref": "#/components/schemas/NewsletterSubscriber"@@ -9416,7 +9411,7 @@ paths:body_html: ''- id: pol_OIJLhNcSbfname: Privacy Policy- slug: privacy-policy-7bb47d79-033e-4437-b9ab-5bb1f3c9be58+ slug: privacy-policy-e6543f47-bbab-41e2-a91c-cf4d4e4ba168body: We respect your privacy.body_html: |<div class="trix-content">@@ -9806,20 +9801,6 @@ components:bearerFormat: JWTdescription: JWT token for authenticated customersschemas:- ClaimReason:- type: object- properties:- id:- type: string- name:- type: string- active:- type: boolean- required:- - id- - name- - active- x-typelizer: truePaginationMeta:type: objectproperties:@@ -10592,6 +10573,20 @@ components:- replacement_variant_id- line_item_idx-typelizer: true+ ClaimReason:+ type: object+ properties:+ id:+ type: string+ name:+ type: string+ active:+ type: boolean+ required:+ - id+ - name+ - active+ x-typelizer: trueClaim:type: objectproperties:@@ -12560,6 +12555,20 @@ components:- line_item_id- fulfillment_item_idx-typelizer: true+ ReturnReason:+ type: object+ properties:+ id:+ type: string+ name:+ type: string+ active:+ type: boolean+ required:+ - id+ - name+ - active+ x-typelizer: trueReturn:type: objectproperties:@@ -12610,20 +12619,6 @@ components:- refunded_at- canceled_atx-typelizer: true- ReturnReason:- type: object- properties:- id:- type: string- name:- type: string- active:- type: boolean- required:- - id- - name- - active- x-typelizer: trueState:type: objectproperties:diff --git a/packages/admin-sdk/examples/permissions/list.ts b/packages/admin-sdk/examples/permissions/list.tsnew file mode 100644index 0000000000..0ee250fbf5--- /dev/null+++ b/packages/admin-sdk/examples/permissions/list.ts@@ -0,0 +1,13 @@+import { createAdminClient } from '@spree/admin-sdk'++const client = createAdminClient({+ baseUrl: 'https://your-store.com',+ secretKey: 'sk_xxx',+})++// region:example+const { data: permissions } = await client.permissions.list()++// endregion:example++export { permissions }diff --git a/packages/admin-sdk/examples/roles/create.ts b/packages/admin-sdk/examples/roles/create.tsnew file mode 100644index 0000000000..8a2d66303a--- /dev/null+++ b/packages/admin-sdk/examples/roles/create.ts@@ -0,0 +1,17 @@+import { createAdminClient } from '@spree/admin-sdk'++const client = createAdminClient({+ baseUrl: 'https://your-store.com',+ secretKey: 'sk_xxx',+})++// region:example+const role = await client.roles.create({+ name: 'order_manager',+ description: 'Handles daily orders',+ permissions: ['write_orders', 'read_customers'],+})++// endregion:example++export { role }diff --git a/packages/admin-sdk/examples/roles/delete.ts b/packages/admin-sdk/examples/roles/delete.tsnew file mode 100644index 0000000000..bcc9848865--- /dev/null+++ b/packages/admin-sdk/examples/roles/delete.ts@@ -0,0 +1,10 @@+import { createAdminClient } from '@spree/admin-sdk'++const client = createAdminClient({+ baseUrl: 'https://your-store.com',+ secretKey: 'sk_xxx',+})++// region:example+await client.roles.delete('role_abc123')+// endregion:examplediff --git a/packages/admin-sdk/examples/roles/update.ts b/packages/admin-sdk/examples/roles/update.tsnew file mode 100644index 0000000000..2f961017f4--- /dev/null+++ b/packages/admin-sdk/examples/roles/update.ts@@ -0,0 +1,15 @@+import { createAdminClient } from '@spree/admin-sdk'++const client = createAdminClient({+ baseUrl: 'https://your-store.com',+ secretKey: 'sk_xxx',+})++// region:example+const role = await client.roles.update('role_abc123', {+ permissions: ['write_orders', 'write_payments', 'read_customers'],+})++// endregion:example++export { role }diff --git a/packages/admin-sdk/src/admin-client.ts b/packages/admin-sdk/src/admin-client.tsindex 2030a8eb53..db9ecd1374 100644--- a/packages/admin-sdk/src/admin-client.ts+++ b/packages/admin-sdk/src/admin-client.ts@@ -87,6 +87,13 @@ export interface MeResponse {avatar_url: string | null}permissions: PermissionRule[]+ /**+ * The flat expanded catalog permission keys the user holds on the current+ * store (`read_orders`, `write_products`, …) — the same vocabulary as API+ * key scopes and the role editor. `write_x` is always accompanied by its+ * implied `read_x`.+ */+ permission_keys: string[]}import type {@@ -184,6 +191,8 @@ import type {ReturnReceiveParams,ReturnRefundParams,ReturnUpdateParams,+ RoleCreateParams,+ RoleUpdateParams,StockItemUpdateParams,StockLocationCreateParams,StockLocationUpdateParams,@@ -238,6 +247,7 @@ import type {OrderRoutingRule,Payment,PaymentMethod,+ Permission,Price,PriceList,Product,@@ -3483,7 +3493,7 @@ export class AdminClient {}// ============================================- // Roles (read-only — for staff role pickers)+ // Roles (staff roles + catalog permissions)// ============================================readonly roles = {@@ -3501,6 +3511,24 @@ export class AdminClient {...options,params: getParams(params),}),++ create: (params: RoleCreateParams, options?: RequestOptions): Promise<Role> =>+ this.request<Role>('POST', '/roles', { ...options, body: params }),++ update: (id: string, params: RoleUpdateParams, options?: RequestOptions): Promise<Role> =>+ this.request<Role>('PATCH', `/roles/${id}`, { ...options, body: params }),++ delete: (id: string, options?: RequestOptions): Promise<void> =>+ this.request<void>('DELETE', `/roles/${id}`, options),+ }++ // ============================================+ // Permissions (the grant vocabulary — read-only catalog)+ // ============================================++ readonly permissions = {+ list: (options?: RequestOptions): Promise<{ data: Permission[]; meta: { count: number } }> =>+ this.request<{ data: Permission[]; meta: { count: number } }>('GET', '/permissions', options),}}diff --git a/packages/admin-sdk/src/params.ts b/packages/admin-sdk/src/params.tsindex 2ac0a4481f..5b705b2088 100644--- a/packages/admin-sdk/src/params.ts+++ b/packages/admin-sdk/src/params.ts@@ -941,6 +941,25 @@ export interface StockTransferCreateParams {variants: Array<{ variant_id: string; quantity: number }>}+export interface RoleCreateParams {+ /** Unique role name (machine identifier shown capitalized in the UI). */+ name: string+ /** Optional human description shown in the roles list. */+ description?: string | null+ /**+ * Catalog permission keys (`read_orders`, `write_products`, …) — discover+ * them via `client.permissions.list()`. A caller may only grant keys they+ * effectively hold.+ */+ permissions?: string[]+}++export interface RoleUpdateParams {+ name?: string+ description?: string | null+ permissions?: string[]+}+export interface AllowedOriginCreateParams {/*** Origin to allow in admin CORS preflight checks. Must be a barediff --git a/packages/admin-sdk/src/types/generated/Permission.ts b/packages/admin-sdk/src/types/generated/Permission.tsnew file mode 100644index 0000000000..9a29b73136--- /dev/null+++ b/packages/admin-sdk/src/types/generated/Permission.ts@@ -0,0 +1,15 @@+// Typelizer digest a6e364ea0983f83912dee41a302c914d+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++interface Permission {+ key: string;+ resource: string;+ kind: string;+ group: string;+ group_label: string;+ label: string;+ description: string;+}++export default Permission;diff --git a/packages/admin-sdk/src/types/generated/Role.ts b/packages/admin-sdk/src/types/generated/Role.tsindex 05bc258986..ba2c5e0abe 100644--- a/packages/admin-sdk/src/types/generated/Role.ts+++ b/packages/admin-sdk/src/types/generated/Role.ts@@ -1,12 +1,16 @@-// Typelizer digest 5e193d55c9f6afeffe8ebbb1b762c0c2+// Typelizer digest e68a2e565e73c1aa5008a742817c242b//// DO NOT MODIFY: This file was automatically generated by Typelizer.interface Role {id: string;name: string;+ description: string | null;created_at: string;updated_at: string;+ permissions: Array<string>;+ mutable: boolean;+ users_count: number;}export default Role;diff --git a/packages/admin-sdk/src/types/generated/index.ts b/packages/admin-sdk/src/types/generated/index.tsindex 42c7b27a01..e4a1531539 100644--- a/packages/admin-sdk/src/types/generated/index.ts+++ b/packages/admin-sdk/src/types/generated/index.ts@@ -1,4 +1,4 @@-// Typelizer digest f3752f6b51964654d3c3a4cc30e5c6ac+// Typelizer digest 4e3a26ed9e48909a90dcc0964ceec485//// DO NOT MODIFY: This file was automatically generated by Typelizer.export type { default as Address } from './Address'@@ -51,6 +51,7 @@ export type { default as Order } from './Order'export type { default as PaymentMethod } from './PaymentMethod'export type { default as Payment } from './Payment'export type { default as PaymentSource } from './PaymentSource'+export type { default as Permission } from './Permission'export type { default as PriceHistory } from './PriceHistory'export type { default as PriceList } from './PriceList'export type { default as PriceRule } from './PriceRule'diff --git a/packages/admin-sdk/src/types/index.ts b/packages/admin-sdk/src/types/index.tsindex 6a0760facf..3fea0d8695 100644--- a/packages/admin-sdk/src/types/index.ts+++ b/packages/admin-sdk/src/types/index.ts@@ -58,6 +58,7 @@ export type { default as OrderRoutingRule } from './generated/OrderRoutingRule'export type { default as Payment } from './generated/Payment'export type { default as PaymentMethod } from './generated/PaymentMethod'export type { default as PaymentSource } from './generated/PaymentSource'+export type { default as Permission } from './generated/Permission'export type { default as Price } from './generated/Price'export type { default as PriceHistory } from './generated/PriceHistory'export type { default as PriceList } from './generated/PriceList'diff --git a/packages/cli/src/commands/completion.ts b/packages/cli/src/commands/completion.tsindex 06002fa68c..f658a5646f 100644--- a/packages/cli/src/commands/completion.ts+++ b/packages/cli/src/commands/completion.ts@@ -38,7 +38,8 @@ const RANSACK_PREDICATES = [const API_VERBS = ['get', 'post', 'patch', 'delete', 'endpoints', 'schema', 'status']-// Keep in sync with `Spree::ApiKey::SCOPES` (spree/core/app/models/spree/api_key.rb).+// Keep in sync with `Spree::ApiKey.known_scopes` — the permission catalog keys+// plus aliases (spree/core/lib/spree/core/permission_configuration.rb).// Not derived from the bundled spec: the spec only annotates per-endpoint// scopes, so the aggregate scopes (read_all/write_all/read_dashboard) wouldn't// appear. Hand-maintained, hence this pointer.@@ -67,12 +68,16 @@ const SCOPES = ['write_stock','read_categories','write_categories',+ 'read_collections',+ 'write_collections','read_settings','write_settings','read_webhooks','write_webhooks','read_api_keys','write_api_keys',+ 'read_staff',+ 'write_staff','read_dashboard',]diff --git a/packages/cli/src/generated/admin-spec.json b/packages/cli/src/generated/admin-spec.jsonindex 0afee6e294..810b0b21c7 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/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, definition is admin-only (was `display_on: back_end`)"},"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_abbr":{"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}/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_abbr":{"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_abbr":{"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_abbr":{"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_abbr":{"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\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":{}}}}}},"/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"}}}},"/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 (taxon) 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/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_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":"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_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":"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_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":"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_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":"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_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":"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_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":"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_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":"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_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":"invitation resent","content":{"application/json":{}}}}}},"/api/v3/admin/roles":{"get":{"summary":"List roles","tags":["Staff"],"security":[{"api_key":[],"bearer_auth":[]}],"description":"Returns the roles available for staff role pickers. Roles are global, not per-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"}}],"responses":{"200":{"description":"roles found","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_abbr":{"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_abbr":{"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/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. fulfillment_type is one of shipping, digital, pickup, pickup_point.\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_type":{"type":"string","enum":["shipping","digital","pickup","pickup_point"]},"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_ids":{"type":"array","items":{"type":"string"}}},"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_abbr":{"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/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"},"fulfillment_types":{"type":"array","items":{"type":"string"},"description":"How products of this type can be delivered."},"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"},"fulfillment_types":{"type":"array","items":{"type":"string"}},"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)"}},"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_abbr":{"type":"string","nullable":true},"quick_checkout":{"type":"boolean"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"},"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_abbr","quick_checkout","is_default_billing","is_default_shipping","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"}},"required":["id","name","code","active","default","storefront_access","guest_checkout","preferred_order_routing_strategy","preferred_storefront_access","preferred_guest_checkout","created_at","updated_at"],"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},"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},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["iso","iso3","name","states_required","zipcode_required","created_at","updated_at"],"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_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_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},"fulfillment_type":{"type":"string"},"estimated_transit_business_days_min":{"type":"number","nullable":true},"estimated_transit_business_days_max":{"type":"number","nullable":true},"admin_name":{"type":"string","nullable":true},"fulfillment_provider":{"type":"string"},"pickup_point_provider":{"type":"string","nullable":true},"storefront_visible":{"type":"boolean"},"tracking_url":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string"},"tax_category_id":{"type":"string","nullable":true},"delivery_zone_ids":{"type":"array","items":{"type":"string"}},"stock_location_ids":{"type":"array","items":{"type":"string"}},"calculator_type":{"type":"string","nullable":true},"calculator_preferences":{"type":"object","nullable":true}},"required":["id","name","code","fulfillment_type","estimated_transit_business_days_min","estimated_transit_business_days_max","admin_name","fulfillment_provider","pickup_point_provider","storefront_visible","tracking_url","created_at","updated_at","deleted_at","tax_category_id","delivery_zone_ids","stock_location_ids","calculator_type","calculator_preferences"],"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"},"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"},"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","display_cost","display_total","display_additional_tax_total","display_included_tax_total","display_tax_total","created_at","updated_at"],"x-typelizer":true},"DeliveryZoneMember":{"type":"object","properties":{"id":{"type":"string"},"member_type":{"type":"string"},"postal_code_prefix":{"type":"string","nullable":true},"postal_code_from":{"type":"string","nullable":true},"postal_code_to":{"type":"string","nullable":true},"country_iso":{"type":"string","nullable":true},"state_abbr":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","member_type","postal_code_prefix","postal_code_from","postal_code_to","country_iso","state_abbr","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_method_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","description","created_at","updated_at","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},"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},"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"}},"metadata":{"type":"object"},"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},"fulfillment_items":{"type":"array","items":{"$ref":"#/components/schemas/FulfillmentItem"}},"order":{"$ref":"#/components/schemas/Order"}},"required":["id","number","tracking","tracking_url","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","items","metadata","adjustment_total","pre_tax_amount","created_at","updated_at","order_id","stock_location_id"],"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},"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"}},"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"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","currency","default_locale","tax_inclusive","default","country_isos","supported_locales","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},"tags":{"type":"array","items":{"type":"string"}},"internal_note":{"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","tags","internal_note","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},"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","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},"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"},"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","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"},"fulfillment_types":{"type":"array","items":{"type":"string"}},"products_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"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","fulfillment_types","products_count","created_at","updated_at","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"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","created_at","updated_at"],"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"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["abbr","name","created_at","updated_at"],"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"},"state_abbr":{"type":"string","nullable":true},"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_text":{"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"},"pickup_ready_in_minutes":{"type":"number","nullable":true},"pickup_instructions":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","state_abbr","name","address1","city","zipcode","country_iso","country_name","state_text","admin_name","address2","state_name","phone","company","active","default","backorderable_default","propagate_all_variants","kind","pickup_enabled","pickup_stock_policy","pickup_ready_in_minutes","pickup_instructions","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_unit_system":{"type":"string"},"preferred_storefront_access":{"type":"string"},"preferred_guest_checkout":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"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_unit_system","preferred_storefront_access","preferred_guest_checkout","preferred_order_routing_strategy","created_at","updated_at","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},"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},"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","created_at","updated_at"],"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/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, definition is admin-only (was `display_on: back_end`)"},"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_abbr":{"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}/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_abbr":{"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_abbr":{"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_abbr":{"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_abbr":{"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\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":{}}}}}},"/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"}}}},"/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 (taxon) 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/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_abbr":{"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_abbr":{"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/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. fulfillment_type is one of shipping, digital, pickup, pickup_point.\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_type":{"type":"string","enum":["shipping","digital","pickup","pickup_point"]},"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_ids":{"type":"array","items":{"type":"string"}}},"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_abbr":{"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/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"},"fulfillment_types":{"type":"array","items":{"type":"string"},"description":"How products of this type can be delivered."},"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"},"fulfillment_types":{"type":"array","items":{"type":"string"}},"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)"}},"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_abbr":{"type":"string","nullable":true},"quick_checkout":{"type":"boolean"},"is_default_billing":{"type":"boolean"},"is_default_shipping":{"type":"boolean"},"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_abbr","quick_checkout","is_default_billing","is_default_shipping","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"}},"required":["id","name","code","active","default","storefront_access","guest_checkout","preferred_order_routing_strategy","preferred_storefront_access","preferred_guest_checkout","created_at","updated_at"],"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},"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},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["iso","iso3","name","states_required","zipcode_required","created_at","updated_at"],"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_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_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},"fulfillment_type":{"type":"string"},"estimated_transit_business_days_min":{"type":"number","nullable":true},"estimated_transit_business_days_max":{"type":"number","nullable":true},"admin_name":{"type":"string","nullable":true},"fulfillment_provider":{"type":"string"},"pickup_point_provider":{"type":"string","nullable":true},"storefront_visible":{"type":"boolean"},"tracking_url":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"string"},"tax_category_id":{"type":"string","nullable":true},"delivery_zone_ids":{"type":"array","items":{"type":"string"}},"stock_location_ids":{"type":"array","items":{"type":"string"}},"calculator_type":{"type":"string","nullable":true},"calculator_preferences":{"type":"object","nullable":true}},"required":["id","name","code","fulfillment_type","estimated_transit_business_days_min","estimated_transit_business_days_max","admin_name","fulfillment_provider","pickup_point_provider","storefront_visible","tracking_url","created_at","updated_at","deleted_at","tax_category_id","delivery_zone_ids","stock_location_ids","calculator_type","calculator_preferences"],"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"},"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"},"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","display_cost","display_total","display_additional_tax_total","display_included_tax_total","display_tax_total","created_at","updated_at"],"x-typelizer":true},"DeliveryZoneMember":{"type":"object","properties":{"id":{"type":"string"},"member_type":{"type":"string"},"postal_code_prefix":{"type":"string","nullable":true},"postal_code_from":{"type":"string","nullable":true},"postal_code_to":{"type":"string","nullable":true},"country_iso":{"type":"string","nullable":true},"state_abbr":{"type":"string","nullable":true},"state_name":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","member_type","postal_code_prefix","postal_code_from","postal_code_to","country_iso","state_abbr","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_method_ids":{"type":"array","items":{"type":"string"}}},"required":["id","name","description","created_at","updated_at","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},"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},"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"}},"metadata":{"type":"object"},"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},"fulfillment_items":{"type":"array","items":{"$ref":"#/components/schemas/FulfillmentItem"}},"order":{"$ref":"#/components/schemas/Order"}},"required":["id","number","tracking","tracking_url","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","items","metadata","adjustment_total","pre_tax_amount","created_at","updated_at","order_id","stock_location_id"],"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},"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"}},"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"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","name","currency","default_locale","tax_inclusive","default","country_isos","supported_locales","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},"tags":{"type":"array","items":{"type":"string"}},"internal_note":{"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","tags","internal_note","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},"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","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"},"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","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"},"fulfillment_types":{"type":"array","items":{"type":"string"}},"products_count":{"type":"number"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"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","fulfillment_types","products_count","created_at","updated_at","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"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["abbr","name","created_at","updated_at"],"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"},"state_abbr":{"type":"string","nullable":true},"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_text":{"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"},"pickup_ready_in_minutes":{"type":"number","nullable":true},"pickup_instructions":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","state_abbr","name","address1","city","zipcode","country_iso","country_name","state_text","admin_name","address2","state_name","phone","company","active","default","backorderable_default","propagate_all_variants","kind","pickup_enabled","pickup_stock_policy","pickup_ready_in_minutes","pickup_instructions","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_unit_system":{"type":"string"},"preferred_storefront_access":{"type":"string"},"preferred_guest_checkout":{"type":"boolean"},"preferred_order_routing_strategy":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"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_unit_system","preferred_storefront_access","preferred_guest_checkout","preferred_order_routing_strategy","created_at","updated_at","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},"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},"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","created_at","updated_at"],"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 filediff --git a/packages/cli/src/generated/resource-paths.json b/packages/cli/src/generated/resource-paths.jsonindex d39fbc4109..8b6ca53af9 100644--- a/packages/cli/src/generated/resource-paths.json+++ b/packages/cli/src/generated/resource-paths.json@@ -1 +1 @@-["/admin_users","/allowed_origins","/api_keys","/auth","/categories","/channels","/collection_rules","/collections","/custom_field_definitions","/customer_groups","/customers","/delivery_methods","/delivery_zones","/exports","/gift_card_batches","/gift_cards","/imports","/invitations","/locales","/markets","/me","/option_types","/order_routing_rules","/orders","/payment_methods","/price_lists","/prices","/product_types","/products","/promotion_actions","/promotion_rules","/promotions","/roles","/stock_locations","/store","/store_credit_categories","/tags","/translatable_resources","/translations","/webhook_endpoints"]\ No newline at end of file+["/admin_users","/allowed_origins","/api_keys","/auth","/categories","/channels","/collection_rules","/collections","/custom_field_definitions","/customer_groups","/customers","/delivery_methods","/delivery_zones","/exports","/gift_card_batches","/gift_cards","/imports","/invitations","/locales","/markets","/me","/option_types","/order_routing_rules","/orders","/payment_methods","/permissions","/price_lists","/prices","/product_types","/products","/promotion_actions","/promotion_rules","/promotions","/roles","/stock_locations","/store","/store_credit_categories","/tags","/translatable_resources","/translations","/webhook_endpoints"]\ No newline at end of filediff --git a/spree/api/app/controllers/concerns/spree/api/v3/admin/role_grant_guard.rb b/spree/api/app/controllers/concerns/spree/api/v3/admin/role_grant_guard.rbindex 77acfd569f..cb6a197d03 100644--- a/spree/api/app/controllers/concerns/spree/api/v3/admin/role_grant_guard.rb+++ b/spree/api/app/controllers/concerns/spree/api/v3/admin/role_grant_guard.rb@@ -2,18 +2,15 @@ module Spreemodule Apimodule V3module Admin- # Shared guard for staff role grants (admin_users#update and- # invitations#create). A grant is rejected when, in order:+ # Shared anti-amplification guards for everything that hands out+ # authority: role grants (admin_users#update, invitations#create),+ # role permission edits (roles#create/#update), and API-key minting.#- # 1. (opt-in) the caller can't `:create` a Spree::RoleUser — i.e. lacks- # the RoleManagement permission set;- # 2. it includes the literal `admin` role and the caller does not hold- # it on the current store;- # 3. it includes any role whose permission sets exceed the caller's own- # (catches SuperUser-equivalent custom roles the name check misses).- #- # API-key principals hold no roles, so they can grant only roles that- # activate no permission sets.+ # The common rule: a caller may only grant authority they effectively+ # hold, compared as expanded catalog keys. A JWT staffer's grant is the+ # union of their store-scoped roles' keys; a secret key's grant is its+ # scopes. Admin-role holders are unbounded; the literal `admin` role is+ # additionally grantable only by admins.module RoleGrantGuardextend ActiveSupport::Concern@@ -43,6 +40,32 @@ module Spreefalseend+ # Rejects granting permission keys beyond the caller's own — used by+ # roles#create/#update on the requested `permissions` array.+ #+ # @param keys [Array<String>]+ # @return [Boolean] true if the request was rejected+ def reject_unauthorized_permission_grant!(keys)+ excess = excess_permission_keys(keys)+ return false if excess.empty?++ deny_role_grant!(+ "You cannot grant permissions beyond your own: #{excess.join(', ')}",+ details: { excess_permissions: excess }+ )+ end++ # The requested keys (expanded) the caller does not hold. Empty when+ # the caller is unbounded.+ #+ # @param keys [Array<String>]+ # @return [Array<String>]+ def excess_permission_keys(keys)+ return [] if caller_holds_admin_role?++ Spree.permissions.expand_keys(keys) - caller_permission_keys+ end+# For API-key principals CanCanCan is permissive (ScopedAuthorization is# their gate), so this only constrains JWT admins.def reject_without_role_management!@@ -59,49 +82,61 @@ module Spreedeny_role_grant!('You cannot grant the admin role.')end- # A caller holding the admin role bounds nothing; the literal admin role- # is already gated by reject_admin_role_grant!.+ # A role is grantable when the caller holds every key it carries.def reject_privilege_escalating_grant!(roles)return false if caller_holds_admin_role?- caller_sets = Spree.permissions.permission_sets_for_roles(caller_role_names)- escalating = roles.reject { |role| grantable_within?(role, caller_sets) }+ escalating = roles.reject { |role| excess_permission_keys(role.permissions).empty? }return false if escalating.empty?deny_role_grant!("You cannot grant roles beyond your own privileges: #{escalating.map(&:name).join(', ')}")end- # A role is grantable when every permission set it activates is one the- # caller already holds.- def grantable_within?(role, caller_sets)- (Spree.permissions.permission_sets_for(role.name) - caller_sets).empty?+ # The caller's effective grant as expanded catalog keys. A JWT+ # staffer contributes their store-scoped roles' keys; a secret-key+ # principal contributes its scopes (aliases expand against the+ # catalog).+ #+ # @return [Array<String>]+ def caller_permission_keys+ @caller_permission_keys ||=+ if scope_limited_principal?+ Spree.permissions.expand_keys(current_api_key.scopes)+ else+ Spree.permissions.expand_keys(caller_roles.flat_map(&:permissions))+ endend- # The caller's store-scoped role names, fetched once per request.- # Scoped by store_id so the caller's own privileges are recognized even- # when their role is held on a non-store resource bound to this store.- def caller_role_names- return @caller_role_names if defined?(@caller_role_names)+ # The caller's store-scoped roles, fetched once per request. Scoped+ # by store_id so the caller's own privileges are recognized even when+ # their role is held on a non-store resource bound to this store.+ #+ # @return [Array<Spree::Role>]+ def caller_roles+ return @caller_roles if defined?(@caller_roles)user = try_spree_current_user- @caller_role_names =+ @caller_roles =if user.respond_to?(:role_users)- user.role_users.where(store: current_store).joins(:role).- pluck("#{Spree::Role.table_name}.name")+ user.role_users.where(store: current_store).includes(:role).map(&:role)else[]endenddef caller_holds_admin_role?- caller_role_names.include?(Spree::Role::ADMIN_ROLE)+ return current_api_key.has_scope?('write_all') if scope_limited_principal?++ caller_roles.any? { |role| role.name == Spree::Role::ADMIN_ROLE } ||+ try_spree_current_user.try(:spree_admin?, current_store)end- def deny_role_grant!(message)+ def deny_role_grant!(message, details: nil)render_error(code: Spree::Api::V3::ErrorHandler::ERROR_CODES[:access_denied],message: message,- status: :forbidden+ status: :forbidden,+ details: details)trueenddiff --git a/spree/api/app/controllers/concerns/spree/api/v3/error_handler.rb b/spree/api/app/controllers/concerns/spree/api/v3/error_handler.rbindex f7e7e1450d..efd741c0cf 100644--- a/spree/api/app/controllers/concerns/spree/api/v3/error_handler.rb+++ b/spree/api/app/controllers/concerns/spree/api/v3/error_handler.rb@@ -166,10 +166,23 @@ module Spreerender_error(code: ERROR_CODES[:access_denied],message: exception.message,- status: :forbidden+ status: :forbidden,+ details: access_denied_details)end+ # Names the catalog permission the failed request needed, derived from+ # the controller's `scoped_resource` declaration — the JWT twin of the+ # scope check's `required_scope` (docs/plans/6.0-admin-rbac.md).+ def access_denied_details+ return unless respond_to?(:scoped_resource_name, true)++ resource = scoped_resource_name+ return unless resource++ { required_permission: "#{action_kind}_#{resource}" }+ end+def handle_gateway_error(exception)Rails.error.report(exception, context: error_context, source: 'spree.api.v3')render_error(diff --git a/spree/api/app/controllers/concerns/spree/api/v3/scoped_authorization.rb b/spree/api/app/controllers/concerns/spree/api/v3/scoped_authorization.rbindex dfb2075b3e..8571959870 100644--- a/spree/api/app/controllers/concerns/spree/api/v3/scoped_authorization.rb+++ b/spree/api/app/controllers/concerns/spree/api/v3/scoped_authorization.rb@@ -73,15 +73,20 @@ module Spreeresolve_current_api_key_for_scope_check!unless current_api_key- return unless secret_key_request?-- # A secret-key token was presented but did not resolve to a live key- # for this store — reject rather than silently skip the scope check.- return render_error(- code: Spree::Api::V3::ErrorHandler::ERROR_CODES[:invalid_token],- message: 'Valid secret API key required',- status: :unauthorized- )+ if secret_key_request?+ # A secret-key token was presented but did not resolve to a live key+ # for this store — reject rather than silently skip the scope check.+ return render_error(+ code: Spree::Api::V3::ErrorHandler::ERROR_CODES[:invalid_token],+ message: 'Valid secret API key required',+ status: :unauthorized+ )+ end++ # JWT staff pass through the same key gate as secret keys: their+ # roles' catalog keys play the role scopes play for keys, so both+ # principals share one enforcement contract per controller.+ return authorize_staff_permission!endresource = scoped_resource_name@@ -101,6 +106,36 @@ module Spree)end+ # The JWT half of the key gate. The staffer's expanded role keys come+ # from Spree::Ability#permission_keys; a custom ability class without+ # that method falls back to plain CanCanCan `authorize!` enforcement.+ def authorize_staff_permission!+ return unless current_user++ resource = scoped_resource_name+ # Fail closed, mirroring the secret-key path: admin controllers must+ # declare their scope (or skip explicitly).+ raise MissingScopedResource, self.class unless resource++ ability = current_ability+ return unless ability.respond_to?(:permission_keys)++ required = "#{action_kind}_#{resource}"+ return if ability.permission_keys.include?(required)++ Rails.logger.info do+ "[Spree] Access denied: user=#{current_user.id} required=#{required} " \+ "held=#{ability.permission_keys.join(',')}"+ end++ render_error(+ code: Spree::Api::V3::ErrorHandler::ERROR_CODES[:access_denied],+ message: "Missing permission: #{required}",+ status: :forbidden,+ details: { required_permission: required }+ )+ end+# True when the request presents a secret API key token (`sk_` prefix),# regardless of whether authentication has resolved it into# `current_api_key` yet. Used to keep the scope guard fail-closed even ifdiff --git a/spree/api/app/controllers/spree/api/v3/admin/admin_users_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/admin_users_controller.rbindex 46510e6fc6..92f680b18c 100644--- a/spree/api/app/controllers/spree/api/v3/admin/admin_users_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/admin/admin_users_controller.rb@@ -10,7 +10,9 @@ module Spreeclass AdminUsersController < ResourceControllerinclude Spree::Api::V3::Admin::RoleGrantGuard- scoped_resource :settings+ # Staff management is the escalation path — its own scope pair,+ # grantable separately from store configuration (6.0-admin-rbac.md).+ scoped_resource :staff# POST is not exposed — staff are created via invitations.def creatediff --git a/spree/api/app/controllers/spree/api/v3/admin/api_keys_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/api_keys_controller.rbindex 8bc6924826..b3a8f70b57 100644--- a/spree/api/app/controllers/spree/api/v3/admin/api_keys_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/admin/api_keys_controller.rb@@ -3,6 +3,8 @@ module Spreemodule V3module Adminclass ApiKeysController < ResourceController+ include Spree::Api::V3::Admin::RoleGrantGuard+# Dedicated scope — key management is credential-administration, not# store configuration. A `write_settings` key must not be able to# revoke or destroy higher-privileged keys.@@ -13,14 +15,19 @@ module Spreeskip_scope_check! only: :current# POST /api/v3/admin/api_keys- # Prevents scope amplification: a key minted via a secret API key can- # only carry scopes that key already holds. A JWT admin is governed by- # CanCanCan (not scopes) and may grant any valid scope — so when a JWT- # user authenticated the request, `current_ability` ignores the API key- # (see AdminAuthentication#current_ability) and we skip the scope cap- # too, even if an `X-Spree-Api-Key` header was also sent.+ # Prevents scope amplification for BOTH principals: a key minted via a+ # secret API key can only carry scopes that key already holds, and a+ # JWT staffer can only mint scopes within their own roles' permission+ # keys (admin-role holders are unbounded). Scopes and role permissions+ # share the catalog vocabulary, so both compare as expanded key sets.def create- if scope_limited_principal? && (excess = requested_scopes.reject { |s| current_api_key.has_scope?(s) }).any?+ if scope_limited_principal?+ excess = requested_scopes.reject { |s| current_api_key.has_scope?(s) }+ else+ excess = excess_permission_keys(requested_scopes)+ end++ if excess.any?return render_error(code: ERROR_CODES[:access_denied],message: "Cannot grant scopes beyond your own: #{excess.join(', ')}",diff --git a/spree/api/app/controllers/spree/api/v3/admin/countries_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/countries_controller.rbindex 2bdd9a1e6f..f7a67a500d 100644--- a/spree/api/app/controllers/spree/api/v3/admin/countries_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/admin/countries_controller.rb@@ -3,7 +3,11 @@ module Spreemodule V3module Adminclass CountriesController < ResourceController- scoped_resource :settings+ # Public reference data (the storefront serves the same list) — exempt+ # from the key gate like `/tags`, so address forms work for any staff+ # member or key. CanCanCan still applies for JWT principals via the+ # staff baseline's Country read grant.+ skip_scope_check!# Override base index to skip pagination — there are ~250 countries# and address-form dropdowns need them all at once. Pagy's globaldiff --git a/spree/api/app/controllers/spree/api/v3/admin/invitations_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/invitations_controller.rbindex c56f25550b..fb3f396724 100644--- a/spree/api/app/controllers/spree/api/v3/admin/invitations_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/admin/invitations_controller.rb@@ -9,7 +9,9 @@ module Spreeclass InvitationsController < ResourceControllerinclude Spree::Api::V3::Admin::RoleGrantGuard- scoped_resource :settings+ # Staff management is the escalation path — its own scope pair,+ # grantable separately from store configuration (6.0-admin-rbac.md).+ scoped_resource :staff# POST /api/v3/admin/invitations# Guards against inviting a new staff member straight into the admindiff --git a/spree/api/app/controllers/spree/api/v3/admin/locales_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/locales_controller.rbindex 080c0d122c..dce6963f28 100644--- a/spree/api/app/controllers/spree/api/v3/admin/locales_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/admin/locales_controller.rb@@ -6,7 +6,9 @@ module Spree# current store (its supported_locales_list), so the dashboard's locale# switcher enumerates locales instead of hardcoding them.class LocalesController < Admin::BaseController- scoped_resource :settings+ # Reference data the dashboard shell needs regardless of the caller's+ # grant — exempt from the key gate like `/tags` and `/countries`.+ skip_scope_check!# GET /api/v3/admin/localesdef indexdiff --git a/spree/api/app/controllers/spree/api/v3/admin/me_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/me_controller.rbindex fd3ec17ea8..3bf68c8d56 100644--- a/spree/api/app/controllers/spree/api/v3/admin/me_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/admin/me_controller.rb@@ -63,10 +63,17 @@ module Spreedef me_response{user: admin_user_serializer.new(current_user, params: serializer_params).to_h,- permissions: serialize_permissions(current_ability)+ permissions: serialize_permissions(current_ability),+ permission_keys: serialize_permission_keys(current_ability)}end+ # The flat expanded catalog keys the user holds on the current store —+ # the same currency the key gate enforces and the role editor grants.+ def serialize_permission_keys(ability)+ ability.respond_to?(:permission_keys) ? ability.permission_keys : []+ end+# Serializes CanCanCan's rules into a flat, JSON-safe list of permission rules.## - Rule order is preserved so the frontend matcher can applydiff --git a/spree/api/app/controllers/spree/api/v3/admin/permissions_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/permissions_controller.rbnew file mode 100644index 0000000000..f16dcb0ec3--- /dev/null+++ b/spree/api/app/controllers/spree/api/v3/admin/permissions_controller.rb@@ -0,0 +1,25 @@+module Spree+ module Api+ module V3+ module Admin+ # The permission catalog discovery endpoint — the vocabulary the role+ # editor and the API-key scope picker render. It is vocabulary, not+ # data, so any authenticated admin credential may read it (same class+ # of exemption as `/tags`).+ class PermissionsController < Admin::BaseController+ skip_scope_check!++ # GET /api/v3/admin/permissions+ def index+ entries = Spree.permissions.entries++ render json: {+ data: entries.map { |entry| Spree.api.admin_permission_serializer.new(entry).to_h },+ meta: { count: entries.size }+ }+ end+ end+ end+ end+ end+enddiff --git a/spree/api/app/controllers/spree/api/v3/admin/roles_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/roles_controller.rbindex 756c1b852d..0a93241a5a 100644--- a/spree/api/app/controllers/spree/api/v3/admin/roles_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/admin/roles_controller.rb@@ -2,12 +2,31 @@ module Spreemodule Apimodule V3module Admin- # Read-only list of roles available for staff role pickers (invite +- # edit forms). Roles are global, not per-store; CRUD is handled- # outside the SPA today and may grow into a richer permissions UI- # later. The controller ignores `current_store` for that reason.+ # Staff roles and their catalog permissions (docs/plans/6.0-admin-rbac.md).+ # Roles are global, not per-store — the controller ignores+ # `current_store` for that reason; assignments (RoleUser) are the+ # store-scoped half. Protection of the admin role and host-locked rows+ # lives on the model (`mutable` guards, `can_be_deleted?`).class RolesController < ResourceController- scoped_resource :settings+ include Spree::Api::V3::Admin::RoleGrantGuard++ scoped_resource :staff++ # POST /api/v3/admin/roles+ # A caller may only grant permissions they effectively hold — the+ # same anti-amplification rule as role grants and API-key minting.+ def create+ return if reject_unauthorized_permission_grant!(requested_permissions)++ super+ end++ # PATCH /api/v3/admin/roles/:id+ def update+ return if params.key?(:permissions) && reject_unauthorized_permission_grant!(requested_permissions)++ super+ endprotected@@ -22,6 +41,20 @@ module Spreedef scopeSpree::Role.accessible_by(current_ability, :show)end++ def collection_includes+ [:role_users]+ end++ def permitted_params+ params.permit(:name, :description, permissions: [])+ end++ private++ def requested_permissions+ Array(params[:permissions]).map(&:to_s).reject(&:blank?)+ endendendenddiff --git a/spree/api/app/serializers/spree/api/v3/admin/permission_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/permission_serializer.rbnew file mode 100644index 0000000000..7a8c87bb8f--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/admin/permission_serializer.rb@@ -0,0 +1,39 @@+module Spree+ module Api+ module V3+ module Admin+ # Serializes one permission catalog entry+ # (Spree::PermissionConfiguration::Entry) for the discovery endpoint.+ # Labels and descriptions resolve through Spree.t so backend extensions+ # localize without shipping dashboard translations.+ class PermissionSerializer+ include Alba::Resource+ include Typelizer::DSL++ typelize key: :string, resource: :string, kind: :string, group: :string,+ group_label: :string, label: :string, description: :string++ attributes :key++ attribute(:resource) { |entry| entry.resource.name.to_s }+ attribute(:kind) { |entry| entry.kind.to_s }+ attribute(:group) { |entry| entry.resource.group.to_s }++ attribute(:group_label) do |entry|+ Spree.t("permissions_catalog.groups.#{entry.resource.group}",+ default: entry.resource.group.to_s.humanize)+ end++ attribute(:label) do |entry|+ Spree.t("permissions_catalog.resources.#{entry.resource.name}.label",+ default: entry.resource.name.to_s.humanize)+ end++ attribute(:description) do |entry|+ Spree.t("permissions_catalog.resources.#{entry.resource.name}.description", default: '')+ end+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/admin/role_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/role_serializer.rbindex 2b5673604f..cbb6688b5a 100644--- a/spree/api/app/serializers/spree/api/v3/admin/role_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/admin/role_serializer.rb@@ -2,14 +2,27 @@ module Spreemodule Apimodule V3module Admin- # Admin API serializer for {Spree::Role}. Read-only — used to populate- # the role picker on the staff invite/edit forms. Spree core ships- # with a single `admin` role today; richer role/permission management- # is on the roadmap.+ # Admin API serializer for {Spree::Role}. Roles are global; permissions+ # are flat catalog keys (see the `/admin/permissions` discovery+ # endpoint). `mutable: false` marks the protected admin role and+ # host-locked rows — the dashboard renders those read-only.class RoleSerializer < V3::BaseSerializer- typelize name: :string+ typelize name: :string, description: 'string | null', mutable: :boolean,+ users_count: :number+ typelize permissions: [:string, multi: true]- attributes :name, created_at: :iso8601, updated_at: :iso8601+ attributes :name, :description, created_at: :iso8601, updated_at: :iso8601++ attribute(:permissions) do |role|+ role.name == Spree::Role::ADMIN_ROLE ? Spree.permissions.catalog_keys : role.permissions+ end++ attribute(:mutable, &:mutable?)++ # Staff assignments on the serialized store.+ attribute :users_count do |role|+ role.role_users.count { |role_user| role_user.store_id == params[:store]&.id }+ endendendenddiff --git a/spree/api/config/routes.rb b/spree/api/config/routes.rbindex 2413af0e7a..527ad103b7 100644--- a/spree/api/config/routes.rb+++ b/spree/api/config/routes.rb@@ -210,7 +210,8 @@ Spree::Core::Engine.add_routes doendendend- resources :roles, only: [:index, :show]+ resources :roles, only: [:index, :show, :create, :update, :destroy]+ resources :permissions, only: [:index]# Direct Uploads (Active Storage)resources :direct_uploads, only: [:create]diff --git a/spree/api/lib/spree/api/dependencies.rb b/spree/api/lib/spree/api/dependencies.rbindex 2d64cf9cde..fd0e35840e 100644--- a/spree/api/lib/spree/api/dependencies.rb+++ b/spree/api/lib/spree/api/dependencies.rb@@ -166,6 +166,7 @@ module Spreeadmin_webhook_delivery_serializer: 'Spree::Api::V3::Admin::WebhookDeliverySerializer',admin_invitation_serializer: 'Spree::Api::V3::Admin::InvitationSerializer',admin_role_serializer: 'Spree::Api::V3::Admin::RoleSerializer',+ admin_permission_serializer: 'Spree::Api::V3::Admin::PermissionSerializer',admin_export_serializer: 'Spree::Api::V3::Admin::ExportSerializer',admin_import_serializer: 'Spree::Api::V3::Admin::ImportSerializer',admin_import_row_serializer: 'Spree::Api::V3::Admin::ImportRowSerializer',diff --git a/spree/api/lib/spree/api/testing_support/v3/base.rb b/spree/api/lib/spree/api/testing_support/v3/base.rbindex caeb9d8ad5..59b65a1d37 100644--- a/spree/api/lib/spree/api/testing_support/v3/base.rb+++ b/spree/api/lib/spree/api/testing_support/v3/base.rb@@ -70,23 +70,16 @@ shared_context 'API v3 Admin authenticated' dolet(:headers) { bearer_headers }end-# Authenticates as an admin whose ability is restricted to a single custom-# permission set, so authorization specs can assert what a limited role can and-# cannot do. Define `custom_permission_set` (a Spree::PermissionSets::Base-# subclass) in the including example. The global permission registry is saved-# and restored around each example so it doesn't leak into other specs.+# Authenticates as an admin whose ability is restricted to specific catalog+# permission keys, so authorization specs can assert what a limited role can+# and cannot do. Define `custom_permissions` (an array of catalog keys, e.g.+# `%w[read_orders write_products]`) in the including example. Roles are data,+# so nothing global is mutated.shared_context 'API v3 Admin with custom permissions' doinclude_context 'API v3 Admin'- around do |example|- saved = Spree.permissions.dup- Spree.permissions.reset!- example.run- ensure- Spree.permissions.replace(saved)- end-- let(:custom_role) { create(:role, name: 'limited') }+ let(:custom_permissions) { [] }+ let(:custom_role) { create(:role, name: 'limited', permissions: custom_permissions) }let(:custom_admin) { create(:admin_user, :without_admin_role) }let(:headers) do{ 'Authorization' => "Bearer #{Spree::Api::V3::TestingSupport.generate_jwt(custom_admin, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_ADMIN)}" }@@ -94,7 +87,6 @@ shared_context 'API v3 Admin with custom permissions' dobefore docustom_admin.spree_roles << custom_role- Spree.permissions.assign(:limited, custom_permission_set)endenddiff --git a/spree/api/spec/controllers/spree/api/v3/admin/admin_users_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/admin_users_controller_spec.rbindex ec6908f221..8760a488e9 100644--- a/spree/api/spec/controllers/spree/api/v3/admin/admin_users_controller_spec.rb+++ b/spree/api/spec/controllers/spree/api/v3/admin/admin_users_controller_spec.rb@@ -19,7 +19,7 @@ RSpec.describe Spree::Api::V3::Admin::AdminUsersController, type: :controller dodescribe 'PATCH #update — role-grant privilege escalation' docontext 'authenticated via a secret API key (no human identity)' do- let(:caller_key) { create(:api_key, :secret, store: store, scopes: ['write_settings']) }+ let(:caller_key) { create(:api_key, :secret, store: store, scopes: ['write_staff']) }let(:headers) { { 'x-spree-api-key' => caller_key.plaintext_token } }it 'forbids granting the admin role' do@@ -39,89 +39,52 @@ RSpec.describe Spree::Api::V3::Admin::AdminUsersController, type: :controller doendend- context 'authenticated as a non-admin staff JWT' do- around do |example|- saved = Spree.permissions.dup- Spree.permissions.reset!- example.run- ensure- Spree.permissions.replace(saved)- end-- let(:user_manager_set) do- Class.new(Spree::PermissionSets::Base) do- def activate!- can :manage, Spree.admin_user_class- can [:read, :admin], Spree::Role- end- end- end-+ context 'authenticated as a staff JWT without staff permissions' do+ let(:orders_role) { create(:role, name: 'orders_only', permissions: %w[write_orders]) }let(:staff_admin) do- create(:admin_user, :without_admin_role).tap { |u| u.role_users.create!(role: staff_role, resource: store) }+ create(:admin_user, :without_admin_role).tap { |u| u.role_users.create!(role: orders_role, resource: store) }endlet(:headers) doapi_key_headers.merge('Authorization' => "Bearer #{Spree::Api::V3::TestingSupport.generate_jwt(staff_admin, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_ADMIN)}")end- before do- Spree.permissions.assign(:staff, user_manager_set)- end-- it 'forbids a non-admin from promoting an account to admin' do+ # Staff records are invisible to a caller without staff permissions —+ # the ability-scoped lookup 404s before any role mutation is reachable.+ it 'cannot promote an account to admin' dopatch :update, params: { id: target.prefixed_id, role_ids: [admin_role.prefixed_id] }, as: :json- expect(response).to have_http_status(:forbidden)+ expect(response).to have_http_status(:not_found)expect(target.reload.spree_admin?(store)).to be(false)end- it 'forbids assigning any role without role-management authority' do+ it 'cannot assign any role' doexpect {patch :update, params: { id: target.prefixed_id, role_ids: [staff_role.prefixed_id] }, as: :json}.not_to change { target.role_users.where(resource: store).count }- expect(response).to have_http_status(:forbidden)+ expect(response).to have_http_status(:not_found)end- # Unknown role ids must not slip the management gate: the reconciliation- # would otherwise strip the target's existing roles.- it 'forbids a role mutation with unresolved role ids' do+ # Unknown role ids must not slip the gates: the reconciliation would+ # otherwise strip the target's existing roles.+ it 'cannot mutate roles with unresolved role ids' doexpect {patch :update, params: { id: target.prefixed_id, role_ids: ['role_nonexistent'] }, as: :json}.not_to change { target.role_users.where(resource: store).count }- expect(response).to have_http_status(:forbidden)+ expect(response).to have_http_status(:not_found)endend- context 'authenticated as a staff JWT holding RoleManagement' do- around do |example|- saved = Spree.permissions.dup- Spree.permissions.reset!- example.run- ensure- Spree.permissions.replace(saved)- end-- let(:role_manager_set) do- Class.new(Spree::PermissionSets::Base) do- def activate!- can :manage, Spree.admin_user_class- can :manage, Spree::RoleUser- can [:read, :admin], Spree::Role- end- end- end-+ context 'authenticated as a staff JWT holding write_staff' do+ let(:manager_role) { create(:role, name: 'team_manager', permissions: %w[write_staff]) }let(:staff_admin) do- create(:admin_user, :without_admin_role).tap { |u| u.role_users.create!(role: staff_role, resource: store) }+ create(:admin_user, :without_admin_role).tap { |u| u.role_users.create!(role: manager_role, resource: store) }endlet(:headers) doapi_key_headers.merge('Authorization' => "Bearer #{Spree::Api::V3::TestingSupport.generate_jwt(staff_admin, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_ADMIN)}")end- before { Spree.permissions.assign(:staff, role_manager_set) }-it 'allows assigning a non-privileged role' dopatch :update, params: { id: target.prefixed_id, role_ids: [staff_role.prefixed_id] }, as: :json@@ -129,9 +92,15 @@ RSpec.describe Spree::Api::V3::Admin::AdminUsersController, type: :controller doexpect(target.role_users.where(resource: store, role: staff_role)).to existend- it 'forbids assigning a SuperUser-equivalent role it does not hold' do- owner_role = create(:role, name: 'owner')- Spree.permissions.assign(:owner, Spree::PermissionSets::SuperUser)+ it 'forbids promoting an account to admin' do+ patch :update, params: { id: target.prefixed_id, role_ids: [admin_role.prefixed_id] }, as: :json++ expect(response).to have_http_status(:forbidden)+ expect(target.reload.spree_admin?(store)).to be(false)+ end++ it 'forbids assigning a role whose permissions exceed its own' do+ owner_role = create(:role, name: 'owner', permissions: Spree.permissions.catalog_keys)patch :update, params: { id: target.prefixed_id, role_ids: [owner_role.prefixed_id] }, as: :jsondiff --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.rbindex fdaca091a0..5f8878d1b6 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@@ -26,13 +26,7 @@ RSpec.describe Spree::Api::V3::Admin::Customers::AddressesController, type: :concontext 'with a limited-role admin that cannot read customers' doinclude_context 'API v3 Admin with custom permissions'- let(:custom_permission_set) do- Class.new(Spree::PermissionSets::Base) do- def activate!- can [:read, :admin], Spree::Product- end- end- end+ let(:custom_permissions) { %w[read_products] }it 'cannot read another customer\'s addresses' doget :index, params: { customer_id: customer.prefixed_id }, as: :jsondiff --git a/spree/api/spec/controllers/spree/api/v3/admin/customers/credit_cards_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/customers/credit_cards_controller_spec.rbindex 93bc341efd..bbb8b461ec 100644--- a/spree/api/spec/controllers/spree/api/v3/admin/customers/credit_cards_controller_spec.rb+++ b/spree/api/spec/controllers/spree/api/v3/admin/customers/credit_cards_controller_spec.rb@@ -47,13 +47,7 @@ RSpec.describe Spree::Api::V3::Admin::Customers::CreditCardsController, type: :ccontext 'with a limited-role admin that cannot read customers' doinclude_context 'API v3 Admin with custom permissions'- let(:custom_permission_set) do- Class.new(Spree::PermissionSets::Base) do- def activate!- can [:read, :admin], Spree::Product- end- end- end+ let(:custom_permissions) { %w[read_products] }it 'cannot read another customer\'s credit cards' doget :index, params: { customer_id: customer.prefixed_id }, as: :jsondiff --git a/spree/api/spec/controllers/spree/api/v3/admin/customers/store_credits_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/customers/store_credits_controller_spec.rbindex 8d13913bb3..a5401d0351 100644--- a/spree/api/spec/controllers/spree/api/v3/admin/customers/store_credits_controller_spec.rb+++ b/spree/api/spec/controllers/spree/api/v3/admin/customers/store_credits_controller_spec.rb@@ -26,13 +26,7 @@ RSpec.describe Spree::Api::V3::Admin::Customers::StoreCreditsController, type: :context 'with a limited-role admin that cannot read customers' doinclude_context 'API v3 Admin with custom permissions'- let(:custom_permission_set) do- Class.new(Spree::PermissionSets::Base) do- def activate!- can [:read, :admin], Spree::Product- end- end- end+ let(:custom_permissions) { %w[read_products] }it 'cannot read another customer\'s store credits' doget :index, params: { customer_id: customer.prefixed_id }, as: :json@@ -49,14 +43,7 @@ RSpec.describe Spree::Api::V3::Admin::Customers::StoreCreditsController, type: :describe 'write authorization with a read-only customer role' doinclude_context 'API v3 Admin with custom permissions'- let(:custom_permission_set) do- Class.new(Spree::PermissionSets::Base) do- def activate!- can [:read, :admin], Spree.customer_class- can :manage, Spree::StoreCredit- end- end- end+ let(:custom_permissions) { %w[read_customers write_store_credits] }it 'allows reading the customer\'s store credits' doget :index, params: { customer_id: customer.prefixed_id }, as: :jsondiff --git a/spree/api/spec/controllers/spree/api/v3/admin/invitations_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/invitations_controller_spec.rbindex 274df5085d..7d22061b4f 100644--- a/spree/api/spec/controllers/spree/api/v3/admin/invitations_controller_spec.rb+++ b/spree/api/spec/controllers/spree/api/v3/admin/invitations_controller_spec.rb@@ -15,7 +15,7 @@ RSpec.describe Spree::Api::V3::Admin::InvitationsController, type: :controller d# a secret API key (which has no human inviter) is the strictest principal# to assert the guard against.context 'authenticated via a secret API key (no human identity)' do- let(:caller_key) { create(:api_key, :secret, store: store, scopes: ['write_settings']) }+ let(:caller_key) { create(:api_key, :secret, store: store, scopes: ['write_staff']) }let(:headers) { { 'x-spree-api-key' => caller_key.plaintext_token } }it 'forbids inviting straight into the admin role' do@@ -28,32 +28,14 @@ RSpec.describe Spree::Api::V3::Admin::InvitationsController, type: :controller dendcontext 'authenticated as a non-admin staff JWT' do- around do |example|- saved = Spree.permissions.dup- Spree.permissions.reset!- example.run- ensure- Spree.permissions.replace(saved)- end-- let(:inviter_set) do- Class.new(Spree::PermissionSets::Base) do- def activate!- can :manage, Spree::Invitation- can [:read, :admin], Spree::Role- end- end- end-+ let(:inviter_role) { create(:role, name: 'team_manager', permissions: %w[write_staff]) }let(:staff_admin) do- create(:admin_user, :without_admin_role).tap { |u| u.role_users.create!(role: staff_role, resource: store) }+ create(:admin_user, :without_admin_role).tap { |u| u.role_users.create!(role: inviter_role, resource: store) }endlet(:headers) doapi_key_headers.merge('Authorization' => "Bearer #{Spree::Api::V3::TestingSupport.generate_jwt(staff_admin, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_ADMIN)}")end- before { Spree.permissions.assign(:staff, inviter_set) }-it 'forbids a non-admin from inviting into the admin role' doexpect {post :create, params: { email: '[email protected]', role_id: admin_role.prefixed_id }, as: :json@@ -71,9 +53,8 @@ RSpec.describe Spree::Api::V3::Admin::InvitationsController, type: :controller dexpect(Spree::Invitation.last.role).to eq(staff_role)end- it 'forbids inviting into a SuperUser-equivalent custom role' do- owner_role = create(:role, name: 'owner')- Spree.permissions.assign(:owner, Spree::PermissionSets::SuperUser)+ it 'forbids inviting into a role whose permissions exceed its own' do+ owner_role = create(:role, name: 'owner', permissions: Spree.permissions.catalog_keys)expect {post :create, params: { email: '[email protected]', role_id: owner_role.prefixed_id }, as: :jsondiff --git a/spree/api/spec/controllers/spree/api/v3/admin/me_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/me_controller_spec.rbindex 966bc1e852..1d51df5975 100644--- a/spree/api/spec/controllers/spree/api/v3/admin/me_controller_spec.rb+++ b/spree/api/spec/controllers/spree/api/v3/admin/me_controller_spec.rb@@ -66,6 +66,27 @@ RSpec.describe Spree::Api::V3::Admin::MeController, type: :controller doexpect(manage_all_rule).to be_presentend+ it 'returns the full catalog as permission_keys for admin users' do+ subject+ expect(json_response['permission_keys']).to eq(Spree.permissions.catalog_keys)+ end++ context 'as a staffer with a limited role' do+ let(:staffer) do+ create(:admin_user, :without_admin_role).tap do |user|+ user.role_users.create!(role: create(:role, name: 'viewer', permissions: %w[write_orders]), resource: store)+ end+ end+ let(:headers) do+ { 'Authorization' => "Bearer #{Spree::Api::V3::TestingSupport.generate_jwt(staffer, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_ADMIN)}" }+ end++ it 'returns the expanded role keys' do+ subject+ expect(json_response['permission_keys']).to eq(%w[read_orders write_orders])+ end+ end+it 'exposes the user avatar_url (null when no photo is attached)' dosubjectexpect(json_response['user']).to have_key('avatar_url')diff --git a/spree/api/spec/controllers/spree/api/v3/admin/orders/items_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/orders/items_controller_spec.rbindex 49d9dd6945..7bcc94b85b 100644--- a/spree/api/spec/controllers/spree/api/v3/admin/orders/items_controller_spec.rb+++ b/spree/api/spec/controllers/spree/api/v3/admin/orders/items_controller_spec.rb@@ -37,24 +37,18 @@ RSpec.describe Spree::Api::V3::Admin::Orders::ItemsController, type: :controllerend# Authorization bypass: a read-only order role must not be able to mutate- # an order it can only view. `authorize_order_access!` requires :update for- # writes, so OrderDisplay (read-only) is rejected.+ # an order it can only view — the key gate rejects the write with the same+ # 403 the read-only secret key gets below.context 'with a read-only order role' doinclude_context 'API v3 Admin with custom permissions'- let(:custom_permission_set) do- Class.new(Spree::PermissionSets::Base) do- def activate!- can [:read, :admin], Spree::Order- can [:read, :admin], Spree::LineItem- end- end- end+ let(:custom_permissions) { %w[read_orders] }it 'forbids adding a line item' doexpect { subject }.not_to change(order.line_items, :count)expect(response).to have_http_status(:forbidden)+ expect(json_response.dig('error', 'details', 'required_permission')).to eq('write_orders')endenddiff --git a/spree/api/spec/controllers/spree/api/v3/admin/permissions_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/permissions_controller_spec.rbnew file mode 100644index 0000000000..db5f8556b2--- /dev/null+++ b/spree/api/spec/controllers/spree/api/v3/admin/permissions_controller_spec.rb@@ -0,0 +1,60 @@+require 'spec_helper'++RSpec.describe Spree::Api::V3::Admin::PermissionsController, type: :controller do+ render_views++ include_context 'API v3 Admin authenticated'++ before { request.headers.merge!(headers) }++ describe 'GET #index' do+ it 'returns the permission catalog' do+ get :index, as: :json++ expect(response).to have_http_status(:ok)+ keys = json_response['data'].map { |entry| entry['key'] }+ expect(keys).to eq(Spree.permissions.catalog_keys)+ end++ it 'describes each entry with resource, kind, group and labels' do+ get :index, as: :json++ entry = json_response['data'].find { |e| e['key'] == 'write_orders' }+ expect(entry).to include(+ 'resource' => 'orders',+ 'kind' => 'write',+ 'group' => 'orders',+ 'label' => 'Orders'+ )+ expect(entry['description']).to be_present+ expect(entry['group_label']).to be_present+ end++ context 'with a limited staff JWT' do+ let(:staffer) do+ create(:admin_user, :without_admin_role).tap do |user|+ user.role_users.create!(role: create(:role, name: 'viewer', permissions: %w[read_orders]), resource: store)+ end+ end+ let(:headers) do+ { 'Authorization' => "Bearer #{Spree::Api::V3::TestingSupport.generate_jwt(staffer, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_ADMIN)}" }+ end++ it 'is readable regardless of the caller grant (vocabulary, not data)' do+ get :index, as: :json++ expect(response).to have_http_status(:ok)+ end+ end++ context 'unauthenticated' do+ let(:headers) { {} }++ it 'requires an admin credential' do+ get :index, as: :json++ expect(response).to have_http_status(:unauthorized)+ end+ end+ end+enddiff --git a/spree/api/spec/controllers/spree/api/v3/admin/roles_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/roles_controller_spec.rbnew file mode 100644index 0000000000..54e2314a69--- /dev/null+++ b/spree/api/spec/controllers/spree/api/v3/admin/roles_controller_spec.rb@@ -0,0 +1,151 @@+require 'spec_helper'++RSpec.describe Spree::Api::V3::Admin::RolesController, type: :controller do+ render_views++ include_context 'API v3 Admin authenticated'++ let!(:admin_role) { Spree::Role.default_admin_role }++ before { request.headers.merge!(headers) }++ describe 'GET #index' do+ let!(:role) { create(:role, name: 'support', permissions: %w[read_orders]) }++ it 'lists roles with permissions and mutability' do+ get :index, as: :json++ expect(response).to have_http_status(:ok)+ names = json_response['data'].map { |r| r['name'] }+ expect(names).to include('admin', 'support')++ support = json_response['data'].find { |r| r['name'] == 'support' }+ expect(support['permissions']).to eq(%w[read_orders])+ expect(support['mutable']).to be true+ expect(support['users_count']).to eq(0)+ end++ it 'reports the admin role as immutable with the full catalog' do+ get :index, as: :json++ admin = json_response['data'].find { |r| r['name'] == 'admin' }+ expect(admin['mutable']).to be false+ expect(admin['permissions']).to eq(Spree.permissions.catalog_keys)+ end+ end++ describe 'POST #create' do+ it 'creates a role with catalog permissions' do+ post :create, params: { name: 'order_manager', description: 'Daily orders', permissions: %w[write_orders read_customers] }, as: :json++ expect(response).to have_http_status(:created)+ expect(json_response['name']).to eq('order_manager')+ expect(json_response['permissions']).to eq(%w[write_orders read_customers])+ expect(json_response['description']).to eq('Daily orders')+ end++ it 'rejects unknown permission keys as validation errors' do+ post :create, params: { name: 'broken', permissions: %w[write_bogus] }, as: :json++ expect(response).to have_http_status(:unprocessable_content)+ end++ context 'as a staffer with limited permissions' do+ let(:staffer) do+ create(:admin_user, :without_admin_role).tap do |user|+ user.role_users.create!(+ role: create(:role, name: 'team_manager', permissions: %w[write_staff read_orders]),+ resource: store+ )+ end+ end+ let(:headers) do+ { 'Authorization' => "Bearer #{Spree::Api::V3::TestingSupport.generate_jwt(staffer, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_ADMIN)}" }+ end++ it 'allows granting keys within its own grant' do+ post :create, params: { name: 'viewer', permissions: %w[read_orders] }, as: :json++ expect(response).to have_http_status(:created)+ end++ it 'forbids granting keys beyond its own grant' do+ post :create, params: { name: 'sneaky', permissions: %w[write_products] }, as: :json++ expect(response).to have_http_status(:forbidden)+ expect(json_response.dig('error', 'details', 'excess_permissions')).to include('write_products')+ expect(Spree::Role.find_by(name: 'sneaky')).to be_nil+ end+ end++ context 'via a secret API key with limited scopes' do+ let(:caller_key) { create(:api_key, :secret, store: store, scopes: %w[write_staff read_orders]) }+ let(:headers) { { 'x-spree-api-key' => caller_key.plaintext_token } }++ it 'is bounded by the key scopes' do+ post :create, params: { name: 'sneaky', permissions: %w[write_products] }, as: :json++ expect(response).to have_http_status(:forbidden)+ end++ it 'allows granting within the key scopes' do+ post :create, params: { name: 'viewer', permissions: %w[read_orders] }, as: :json++ expect(response).to have_http_status(:created)+ end+ end+ end++ describe 'PATCH #update' do+ let!(:role) { create(:role, name: 'support', permissions: %w[read_orders]) }++ it 'updates name, description and permissions' do+ patch :update, params: { id: role.prefixed_id, name: 'helpdesk', permissions: %w[read_orders read_customers] }, as: :json++ expect(response).to have_http_status(:ok)+ expect(role.reload.name).to eq('helpdesk')+ expect(role.permissions).to eq(%w[read_orders read_customers])+ end++ it 'rejects renaming the admin role' do+ patch :update, params: { id: admin_role.prefixed_id, name: 'owner' }, as: :json++ expect(response).to have_http_status(:unprocessable_content)+ expect(admin_role.reload.name).to eq('admin')+ end++ it 'rejects changing admin role permissions' do+ patch :update, params: { id: admin_role.prefixed_id, permissions: %w[read_orders] }, as: :json++ expect(response).to have_http_status(:unprocessable_content)+ end+ end++ describe 'DELETE #destroy' do+ it 'deletes an unreferenced role' do+ role = create(:role, name: 'obsolete')++ delete :destroy, params: { id: role.prefixed_id }, as: :json++ expect(response).to have_http_status(:no_content)+ expect(Spree::Role.find_by(name: 'obsolete')).to be_nil+ end++ it 'refuses to delete the admin role' do+ delete :destroy, params: { id: admin_role.prefixed_id }, as: :json++ expect(response).to have_http_status(:unprocessable_content)+ expect(Spree::Role.find_by(name: 'admin')).to be_present+ end++ it 'refuses to delete a role still assigned to staff' do+ role = create(:role, name: 'in_use')+ create(:admin_user, :without_admin_role).role_users.create!(role: role, resource: store)++ delete :destroy, params: { id: role.prefixed_id }, as: :json++ expect(response).to have_http_status(:unprocessable_content)+ expect(Spree::Role.find_by(name: 'in_use')).to be_present+ end+ end+enddiff --git a/spree/api/spec/controllers/spree/api/v3/scoped_authorization_spec.rb b/spree/api/spec/controllers/spree/api/v3/scoped_authorization_spec.rbindex 64021b2a03..19a0743769 100644--- a/spree/api/spec/controllers/spree/api/v3/scoped_authorization_spec.rb+++ b/spree/api/spec/controllers/spree/api/v3/scoped_authorization_spec.rb@@ -86,17 +86,54 @@ RSpec.describe Spree::Api::V3::Admin::OrdersController, type: :controller doenddescribe 'JWT-authenticated request' do- # JWT bypasses scope checks; CanCanCan abilities apply instead.+ # JWT staff pass through the same key gate: their roles' catalog keys play+ # the role scopes play for secret keys (docs/plans/6.0-admin-rbac.md).before dorequest.headers['X-Spree-Api-Key'] = nil- request.headers['Authorization'] = "Bearer #{admin_jwt_token}"+ request.headers['Authorization'] = "Bearer #{jwt_token}"end- let(:scopes) { ['read_customers'] } # irrelevant — JWT auth doesn't read scopes+ let(:scopes) { ['read_customers'] } # irrelevant — JWT auth doesn't read key scopes- it 'bypasses scope checks' do- get :index, as: :json- expect(response).to have_http_status(:ok)+ context 'as a full admin' do+ let(:jwt_token) { admin_jwt_token }++ it 'passes the key gate' do+ get :index, as: :json+ expect(response).to have_http_status(:ok)+ end+ end++ context 'as a staffer whose roles grant the required key' do+ let(:staffer) do+ create(:admin_user, :without_admin_role).tap do |user|+ user.role_users.create!(role: create(:role, name: 'viewer', permissions: %w[read_orders]), resource: store)+ end+ end+ let(:jwt_token) { Spree::Api::V3::TestingSupport.generate_jwt(staffer, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_ADMIN) }++ it 'allows the read' do+ get :index, as: :json+ expect(response).to have_http_status(:ok)+ end+ end++ context 'as a staffer whose roles lack the required key' do+ let(:staffer) do+ create(:admin_user, :without_admin_role).tap do |user|+ user.role_users.create!(role: create(:role, name: 'other', permissions: %w[read_customers]), resource: store)+ end+ end+ let(:jwt_token) { Spree::Api::V3::TestingSupport.generate_jwt(staffer, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_ADMIN) }++ it 'denies with the missing permission named' do+ get :index, as: :json++ expect(response).to have_http_status(:forbidden)+ body = JSON.parse(response.body)+ expect(body['error']['code']).to eq('access_denied')+ expect(body['error']['details']['required_permission']).to eq('read_orders')+ endendendend@@ -176,7 +213,7 @@ RSpec.describe Spree::Api::V3::Admin::DashboardController, type: :controller dorequest.headers['Authorization'] = "Bearer #{admin_jwt_token}"end- it 'passes the scope guard (CanCanCan applies instead)' do+ it 'passes the key gate (admin holds the full catalog)' doget :analytics, as: :jsonexpect(response).to have_http_status(:ok)enddiff --git a/spree/api/spec/integration/spree/api/v3/admin/admin_users_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/admin_users_spec.rbindex 8152771a49..9b10ff165b 100644--- a/spree/api/spec/integration/spree/api/v3/admin/admin_users_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/admin_users_spec.rb@@ -24,7 +24,7 @@ RSpec.describe 'Admin Staff API', type: :request, swagger_doc: 'api-reference/adproduces 'application/json'security [api_key: [], bearer_auth: []]description 'Returns admin users with at least one role assignment on the current store.'- admin_scope :read, :settings+ admin_scope :read, :staffadmin_sdk_example 'admin-users/list'@@ -50,7 +50,7 @@ RSpec.describe 'Admin Staff API', type: :request, swagger_doc: 'api-reference/adtags 'Staff'produces 'application/json'security [api_key: [], bearer_auth: []]- admin_scope :read, :settings+ admin_scope :read, :staffadmin_sdk_example 'admin-users/get'@@ -77,7 +77,7 @@ RSpec.describe 'Admin Staff API', type: :request, swagger_doc: 'api-reference/adsecurity [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.'- admin_scope :write, :settings+ admin_scope :write, :staffadmin_sdk_example 'admin-users/update'@@ -109,7 +109,7 @@ RSpec.describe 'Admin Staff API', type: :request, swagger_doc: 'api-reference/adtags '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."- admin_scope :write, :settings+ admin_scope :write, :staffadmin_sdk_example 'admin-users/delete'diff --git a/spree/api/spec/integration/spree/api/v3/admin/invitations_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/invitations_spec.rbindex 48bfe262cf..f3188f4539 100644--- a/spree/api/spec/integration/spree/api/v3/admin/invitations_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/invitations_spec.rb@@ -17,7 +17,7 @@ RSpec.describe 'Admin Invitations API', type: :request, swagger_doc: 'api-refereproduces 'application/json'security [api_key: [], bearer_auth: []]description 'Returns invitations for the current store, including pending and accepted.'- admin_scope :read, :settings+ admin_scope :read, :staffadmin_sdk_example 'invitations/list'@@ -42,7 +42,7 @@ RSpec.describe 'Admin Invitations API', type: :request, swagger_doc: 'api-referesecurity [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.'- admin_scope :write, :settings+ admin_scope :write, :staffadmin_sdk_example 'invitations/create'@@ -77,7 +77,7 @@ RSpec.describe 'Admin Invitations API', type: :request, swagger_doc: 'api-referedelete 'Revoke an invitation' dotags 'Staff'security [api_key: [], bearer_auth: []]- admin_scope :write, :settings+ admin_scope :write, :staffadmin_sdk_example 'invitations/delete'@@ -101,7 +101,7 @@ RSpec.describe 'Admin Invitations API', type: :request, swagger_doc: 'api-refereproduces 'application/json'security [api_key: [], bearer_auth: []]description 'Issues a fresh token and dispatches the invitation email again.'- admin_scope :write, :settings+ admin_scope :write, :staffadmin_sdk_example 'invitations/resend'diff --git a/spree/api/spec/integration/spree/api/v3/admin/permissions_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/permissions_spec.rbnew file mode 100644index 0000000000..d084dcea58--- /dev/null+++ b/spree/api/spec/integration/spree/api/v3/admin/permissions_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++require 'swagger_helper'++RSpec.describe 'Admin Permissions API', type: :request, swagger_doc: 'api-reference/admin.yaml' do+ include_context 'API v3 Admin'++ let(:Authorization) { "Bearer #{admin_jwt_token}" }++ path '/api/v3/admin/permissions' do+ get 'List the permission catalog' do+ tags 'Staff'+ produces 'application/json'+ 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.'++ admin_sdk_example 'permissions/list'++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true++ response '200', 'catalog returned' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }++ run_test! do |response|+ data = JSON.parse(response.body)+ expect(data['data'].pluck('key')).to include('read_orders', 'write_orders', 'write_staff')+ entry = data['data'].find { |e| e['key'] == 'write_orders' }+ expect(entry).to include('resource' => 'orders', 'kind' => 'write', 'group' => 'orders')+ end+ end+ end+ end+enddiff --git a/spree/api/spec/integration/spree/api/v3/admin/roles_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/roles_spec.rbindex d48a287d2d..816a300821 100644--- a/spree/api/spec/integration/spree/api/v3/admin/roles_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/roles_spec.rb@@ -13,8 +13,9 @@ RSpec.describe 'Admin Roles API', type: :request, swagger_doc: 'api-reference/adtags 'Staff'produces 'application/json'security [api_key: [], bearer_auth: []]- description 'Returns the roles available for staff role pickers. Roles are global, not per-store.'- admin_scope :read, :settings+ 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.'+ admin_scope :read, :staffadmin_sdk_example 'roles/list'@@ -31,5 +32,114 @@ RSpec.describe 'Admin Roles API', type: :request, swagger_doc: 'api-reference/adendendend++ post 'Create a role' do+ tags 'Staff'+ consumes 'application/json'+ produces 'application/json'+ 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.'+ admin_scope :write, :staff++ admin_sdk_example 'roles/create'++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true+ parameter name: :role, in: :body, schema: {+ type: :object,+ properties: {+ name: { type: :string, example: 'order_manager' },+ description: { type: :string, nullable: true, example: 'Handles daily orders' },+ permissions: { type: :array, items: { type: :string }, example: %w[write_orders read_customers] }+ },+ required: %w[name]+ }++ response '201', 'role created' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }+ let(:role) { { name: 'order_manager', description: 'Handles daily orders', permissions: %w[write_orders read_customers] } }++ run_test! do |response|+ data = JSON.parse(response.body)+ expect(data['name']).to eq('order_manager')+ expect(data['permissions']).to eq(%w[write_orders read_customers])+ end+ end++ response '422', 'invalid request' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }+ let(:role) { { name: 'broken', permissions: %w[write_bogus] } }++ run_test!+ end+ end+ end++ path '/api/v3/admin/roles/{id}' do+ parameter name: :id, in: :path, type: :string++ patch 'Update a role' do+ tags 'Staff'+ consumes 'application/json'+ produces 'application/json'+ security [api_key: [], bearer_auth: []]+ description 'Updates a role name, description or permissions. The admin role and host-locked ' \+ 'roles (`mutable: false`) reject changes.'+ admin_scope :write, :staff++ admin_sdk_example 'roles/update'++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true+ parameter name: :role, in: :body, schema: {+ type: :object,+ properties: {+ name: { type: :string },+ description: { type: :string, nullable: true },+ permissions: { type: :array, items: { type: :string } }+ }+ }++ response '200', 'role updated' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }+ let(:existing_role) { create(:role, name: 'support', permissions: %w[read_orders]) }+ let(:id) { existing_role.prefixed_id }+ let(:role) { { permissions: %w[read_orders read_customers] } }++ run_test! do |response|+ data = JSON.parse(response.body)+ expect(data['permissions']).to eq(%w[read_orders read_customers])+ end+ end+ end++ delete 'Delete a role' do+ tags 'Staff'+ produces 'application/json'+ 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.'+ admin_scope :write, :staff++ admin_sdk_example 'roles/delete'++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true++ response '204', 'role deleted' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }+ let(:id) { create(:role, name: 'obsolete').prefixed_id }++ run_test!+ end++ response '422', 'role cannot be deleted' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }+ let(:id) { admin_role.prefixed_id }++ run_test!+ end+ endendenddiff --git a/spree/core/app/models/spree/ability.rb b/spree/core/app/models/spree/ability.rbindex 0ca5c80ba9..03c58ba344 100644--- a/spree/core/app/models/spree/ability.rb+++ b/spree/core/app/models/spree/ability.rb@@ -1,33 +1,92 @@-# Implementation class for Cancan gem. Permissions are configured through-# permission sets — see Spree::PermissionSets::Base for details on creating-# custom ones.+# CanCanCan ability for both halves of Spree authorization:#-# @example Configuring role permissions-# Spree.permissions.assign(:customer_service, [-# Spree::PermissionSets::OrderDisplay,-# Spree::PermissionSets::UserManagement-# ])+# - **Staff** (admin-user principals) are authorized through the permission+# catalog: their store-scoped roles hold flat `read_<resource>` /+# `write_<resource>` keys (see Spree::PermissionConfiguration and+# docs/plans/6.0-admin-rbac.md), which compile to CanCanCan rules here. The+# `admin` role grants everything.+# - **Customers and guests** get the fixed storefront baseline: read the+# catalog, own their carts/orders/account. It is not configurable and is not+# part of the permission catalog — customer authorization is ownership, not+# RBAC.+#+# Host applications needing rules the catalog cannot express (record-level+# conditions, regional restrictions) register a plain CanCan::Ability class:+#+# class RegionalSupportAbility+# include CanCan::Ability+#+# def initialize(user)+# can :read, Spree::Order, market_id: user.market_id if user+# end+# end+#+# Spree::Ability.register_ability(RegionalSupportAbility)#-# See https://github.com/CanCanCommunity/cancancan for more details.require 'cancan'module Spreeclass Abilityinclude CanCan::Ability- # @return [Object] the current user+ # @return [Object] the current user (a customer, an admin user, or a new+ # customer instance for guests)attr_reader :user# @return [Spree::Store, nil] the current storeattr_reader :store+ # @return [Array<String>] the expanded catalog keys this ability activated+ # (empty for storefront principals). Feeds `/me` and the admin key gate.+ attr_reader :permission_keys++ class << self+ # Registers an extra ability class merged into every Spree::Ability.+ #+ # @param ability_class [Class] a CanCan::Ability whose initializer takes+ # the user+ def register_ability(ability_class)+ abilities.add(ability_class)+ end++ # @param ability_class [Class]+ def remove_ability(ability_class)+ abilities.delete(ability_class)+ end++ # @return [Set<Class>]+ def abilities+ @abilities ||= Set.new+ end+ end+def initialize(user, options = {})alias_cancan_delete_action@user = user || Spree.customer_class.new@store = options[:store] || Spree::Current.store+ @permission_keys = []++ if staff_principal?+ apply_staff_permissions+ else+ apply_storefront_permissions+ end- apply_permissions_from_sets+ merge_registered_abilities+ end++ # Applies a single catalog key's grants and records it as activated.+ # Public so `register_ability` classes and host subclasses can grant+ # catalog capabilities in the same currency the key gate checks.+ #+ # @param key [String, Symbol] a catalog key (`'write_orders'`)+ # @return [Boolean] whether the key resolved+ def activate_permission(key)+ return false unless Spree.permissions.activate_key(self, key)++ @permission_keys |= Spree.permissions.expand_keys([key])+ trueendprotected@@ -37,45 +96,143 @@ module Spreealias_action :create, :update, :destroy, to: :modifyend- # Applies permissions based on the user's roles and the configured permission sets.- def apply_permissions_from_sets- role_names = determine_role_names- permission_sets = Spree.permissions.permission_sets_for_roles(role_names)- activate_permission_sets(permission_sets)+ # Staff = a persisted admin-user principal. Customers never resolve roles+ # (storefront authorization is ownership, not RBAC), which also spares a+ # role_users query on every storefront request.+ def staff_principal?+ @user.persisted? && @user.is_a?(Spree.admin_user_class)end- # Determines the role names for the current user, scoped to the current- # store. A +Spree::RoleUser+ is bound to a store via its +store_id+ (set from- # the role's resource), so a role held on one store does not apply on another,- # independent of the polymorphic +resource+ the role is attached to.- #- # @return [Array<Symbol>] the role names- def determine_role_names- return [:default] unless @user.persisted?-- if @user.respond_to?(:role_users)- role_names = @user.role_users.where(store: @store).- joins(:role).- pluck("#{Spree::Role.table_name}.name").map(&:to_sym).uniq- return role_names if role_names.any?- end+ # --- staff ---- # Fall back to checking spree_admin? for backward compatibility- # This supports cases where roles are mocked or admin status is determined differently- if @user.try(:spree_admin?, @store)- [:admin]+ def apply_staff_permissions+ roles = staff_roles++ if roles.any? { |role| role.name == Spree::Role::ADMIN_ROLE } || implicit_admin?(roles)+ activate_full_accesselse- [:default]+ apply_staff_baseline+ Spree.permissions.expand_keys(roles.flat_map(&:permissions)).each do |key|+ activate_permission(key)+ endendend- # Activates the given permission sets.+ # The user's roles on the current store.#- # @param permission_sets [Array<Class>] the permission set classes to activate- def activate_permission_sets(permission_sets)- permission_sets.each do |permission_set_class|- permission_set = permission_set_class.new(self)- permission_set.activate!+ # @return [Array<Spree::Role>]+ def staff_roles+ return [] unless @user.respond_to?(:role_users)++ @staff_roles ||= @user.role_users.where(store: @store).includes(:role).map(&:role)+ end++ # Backward-compatible fallback for principals with no role rows whose+ # admin status is determined differently (e.g. mocked in specs).+ def implicit_admin?(roles)+ roles.empty? && @user.try(:spree_admin?, @store)+ end++ # Full access. Record-state safety (order cancel/destroy eligibility, the+ # admin role's immutability) is enforced by model and workflow guards, not+ # ability rules — see the Axis A/B split in docs/plans/decisions.md.+ def activate_full_access+ can :manage, :all+ @permission_keys = Spree.permissions.catalog_keys+ end++ # Reference data every staff member can read regardless of keys — address+ # forms need countries/states, and the dashboard shell reads the store.+ def apply_staff_baseline+ can :read, Spree::Country+ can :read, Spree::State+ can :read, Spree::Store+ end++ # --- storefront (customers and guests) ---++ # The fixed storefront baseline: browse the catalog, own your cart, order+ # and account. Ownership is expressed through hash conditions and cart+ # tokens; the Store API's scope-fetching remains the primary enforcement.+ def apply_storefront_permissions+ apply_storefront_catalog_permissions+ apply_storefront_purchase_permissions+ apply_storefront_account_permissions+ end++ def apply_storefront_catalog_permissions+ can :read, Spree::Collection+ can :read, Spree::Country+ can :read, Spree::OptionType+ can :read, Spree::OptionValue+ can :read, Spree::Product+ can :read, Spree::State+ can :read, Spree::Store+ can :read, Spree::Category+ can :read, Spree::Taxonomy+ can :read, Spree::Variant+ can :read, Spree::Zone+ can :read, Spree::Policy+ end++ def apply_storefront_purchase_permissions+ can :create, Spree::Order+ can :show, Spree::Order do |order, token|+ order.customer == user || order.token && token == order.token+ end+ can :update, Spree::Order do |order, token|+ !order.completed? && (order.customer == user || order.token && token == order.token)+ end++ can :create, Spree::Cart+ can :show, Spree::Cart do |cart, token|+ cart.customer == user || cart.token && token == cart.token+ end+ can [:update, :destroy], Spree::Cart do |cart, token|+ !cart.completed? && (cart.customer == user || cart.token && token == cart.token)+ end++ can :create, Spree::LineItem do |line_item, token|+ owner = line_item.owner+ owner.customer == user || owner.token && token == owner.token+ end+ can [:update, :destroy], Spree::LineItem do |line_item, token|+ owner = line_item.owner+ !owner.completed? && (owner.customer == user || owner.token && token == owner.token)+ end++ # Digital downloads - token-based access+ can :show, Spree::DigitalLink do |digital_link, token|+ digital_link.token == token+ end+ end++ def apply_storefront_account_permissions+ can :create, Spree.customer_class+ can [:show, :update, :destroy], Spree.customer_class, id: user.id++ can :manage, Spree::Address, user_id: user.id if user.persisted?+ can [:read, :destroy], Spree::CreditCard, user_id: user.id+ can :read, Spree::GiftCard, user_id: user.id+ can [:show, :destroy], Spree::NewsletterSubscriber, user_id: user.id++ can :manage, Spree::Wishlist, user_id: user.id+ can :show, Spree::Wishlist do |wishlist|+ wishlist.customer == user || wishlist.is_private == false+ end+ can [:create, :update, :destroy], Spree::WishedItem do |wished_item|+ wished_item.wishlist.customer == user+ end++ can :accept, Spree::Invitation,+ invitee_id: [user.id, nil], invitee_type: user.class.name, status: 'pending'+ end++ # --- extensions ---++ def merge_registered_abilities+ self.class.abilities.each do |ability_class|+ merge(ability_class.new(@user))endendenddiff --git a/spree/core/app/models/spree/api_key.rb b/spree/core/app/models/spree/api_key.rbindex f5767c72af..d81bf3b022 100644--- a/spree/core/app/models/spree/api_key.rb+++ b/spree/core/app/models/spree/api_key.rb@@ -8,28 +8,18 @@ module SpreePREFIXES = { 'publishable' => 'pk_', 'secret' => 'sk_' }.freezeTOKEN_LENGTH = 24- # Admin API authorization scopes. Granted to secret keys at creation; checked- # by ScopedAuthorization on every admin request. See- # docs/plans/5.5-admin-api-key-scopes.md for the full design.- SCOPES = %w[- read_orders write_orders- read_products write_products- read_promotions write_promotions- read_customers write_customers- read_payments write_payments- read_fulfillments write_fulfillments- read_refunds write_refunds- read_gift_cards write_gift_cards- read_store_credits write_store_credits- read_stock write_stock- read_categories write_categories- read_collections write_collections- read_settings write_settings- read_webhooks write_webhooks- read_api_keys write_api_keys- read_dashboard- read_all write_all- ].freeze+ # Convenience aliases expanded at check time (never stored expanded).+ ALIAS_SCOPES = %w[read_all write_all].freeze++ # Admin API authorization scopes — the permission catalog keys plus the+ # aliases. Derived from the catalog so an extension registering a resource+ # (`Spree.permissions.register_resource`) makes its keys mintable on secret+ # keys with no further wiring. See docs/plans/6.0-admin-rbac.md.+ #+ # @return [Array<String>]+ def self.known_scopes+ Spree.permissions.catalog_keys + ALIAS_SCOPES+ end# Scopes are stored in a JSON column (jsonb on PostgreSQL, json elsewhere).# The DB driver handles array <-> JSON conversion; no `serialize` needed.@@ -160,7 +150,7 @@ module Spreeenddef validate_known_scopes- invalid = scopes - SCOPES+ invalid = scopes - self.class.known_scopeserrors.add(:scopes, "contains unknown scopes: #{invalid.join(', ')}") if invalid.any?enddiff --git a/spree/core/app/models/spree/order.rb b/spree/core/app/models/spree/order.rbindex c98a4d1c4b..2d98d61da4 100644--- a/spree/core/app/models/spree/order.rb+++ b/spree/core/app/models/spree/order.rb@@ -212,6 +212,10 @@ module Spreebefore_create :link_by_emailbefore_update :ensure_updated_fulfillments, :homogenize_line_item_currencies, if: :currency_changed?+ # Record-state deletion eligibility is enforced here, not in ability rules —+ # secret-key API requests never consult CanCanCan (Axis A/B split,+ # docs/plans/decisions.md 2026-08-05).+ before_destroy :ensure_can_be_deleted# Shared money/quantity validations live in Spree::Purchase::Validations;# only order-specific rules stay here.@@ -986,6 +990,13 @@ module Spreeprivate+ def ensure_can_be_deleted+ return true if can_be_deleted?++ errors.add(:base, Spree.t(:order_cannot_be_deleted))+ throw :abort+ end+def valid_order_routing_strategy_class(klass_name)return if klass_name.blank?diff --git a/spree/core/app/models/spree/permission_sets/base.rb b/spree/core/app/models/spree/permission_sets/base.rbdeleted file mode 100644index f42a9f2617..0000000000--- a/spree/core/app/models/spree/permission_sets/base.rb+++ /dev/null@@ -1,81 +0,0 @@-# Base class for all permission sets.-#-# Permission sets are reusable groups of permissions that can be assigned to roles.-# They provide a clean abstraction over CanCanCan abilities, making it easier to-# manage permissions in a modular way.-#-# @example Creating a custom permission set-# class Spree::PermissionSets::InventoryManagement < Spree::PermissionSets::Base-# def activate!-# can :manage, Spree::StockItem-# can :manage, Spree::StockLocation-# can :manage, Spree::StockMovement-# end-# end-#-# @example Assigning the permission set to a role-# Spree.permissions.assign(:warehouse_manager, Spree::PermissionSets::InventoryManagement)-#-module Spree- module PermissionSets- class Base- # @return [CanCan::Ability] the ability instance to add permissions to- attr_reader :ability-- # @param ability [CanCan::Ability] the ability instance to add permissions to- def initialize(ability)- @ability = ability- end-- # Activates this permission set by adding its permissions to the ability.- # Override this method in subclasses to define the permissions.- #- # @abstract- # @return [void]- def activate!- raise NotImplementedError, "#{self.class} must implement #activate!"- end-- protected-- # Delegates the `can` method to the ability instance.- #- # @param args [Array] arguments to pass to CanCan::Ability#can- # @param block [Proc] optional block for conditional permissions- def can(*args, &block)- ability.can(*args, &block)- end-- # Delegates the `cannot` method to the ability instance.- #- # @param args [Array] arguments to pass to CanCan::Ability#cannot- # @param block [Proc] optional block for conditional permissions- def cannot(*args, &block)- ability.cannot(*args, &block)- end-- # Delegates the `can?` method to the ability instance.- #- # @param args [Array] arguments to pass to CanCan::Ability#can?- # @return [Boolean]- def can?(*args)- ability.can?(*args)- end-- # Returns the user from the ability instance.- # This method assumes the ability has a user accessor.- #- # @return [Object] the current user- def user- ability.user- end-- # Returns the store from the ability instance options.- #- # @return [Spree::Store, nil] the current store- def store- ability.store- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/configuration_management.rb b/spree/core/app/models/spree/permission_sets/configuration_management.rbdeleted file mode 100644index bd3da23ef9..0000000000--- a/spree/core/app/models/spree/permission_sets/configuration_management.rb+++ /dev/null@@ -1,66 +0,0 @@-# Permission set for managing store configuration and settings.-#-# This permission set provides access to manage store settings,-# payment methods, shipping methods, and other configuration.-#-# @example-# Spree.permissions.assign(:store_admin, Spree::PermissionSets::ConfigurationManagement)-#-module Spree- module PermissionSets- class ConfigurationManagement < Base- def activate!- # Store settings- can :manage, Spree::Store-- # Payment configuration- can :manage, Spree::PaymentMethod- can :manage, Spree::Gateway-- # Delivery configuration. Stock locations ride along: pickup methods- # bind them, so delivery configuration and location management are- # the same capability.- can :manage, Spree::DeliveryMethod- can :manage, Spree::StockLocation- can :manage, Spree::DeliveryMethodRule- can :manage, Spree::DeliveryZone- can :manage, Spree::DeliveryZoneMember- can :manage, Spree::ShippingCategory- can :manage, Spree::Zone- can :manage, Spree::ZoneMember-- # Markets — Channel / Market is the long-term replacement for- # Zone (see docs/plans/6.0-tax-provider.md), but both coexist- # during the migration and need admin read/write either way.- can :manage, Spree::Market-- # Tax configuration- can :manage, Spree::TaxCategory- can :manage, Spree::TaxRate-- # CORS allowlist used by Rack::Cors + admin cookie auth (see- # docs/plans/5.5-admin-auth-cookie-refresh.md).- can :manage, Spree::AllowedOrigin-- # Webhooks- can :manage, Spree::WebhookEndpoint- can :manage, Spree::WebhookDelivery-- # General configuration- can :manage, Spree::RefundReason- can :manage, Spree::ReturnReason- can :manage, Spree::ClaimReason-- # Channels + per-channel order routing rules- can :manage, Spree::Channel- can :manage, Spree::OrderRoutingRule-- # Metafield configuration- can :manage, Spree::MetafieldDefinition-- # Policies- can :manage, Spree::Policy- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/dashboard_display.rb b/spree/core/app/models/spree/permission_sets/dashboard_display.rbdeleted file mode 100644index ddf680e75f..0000000000--- a/spree/core/app/models/spree/permission_sets/dashboard_display.rb+++ /dev/null@@ -1,17 +0,0 @@-# Permission set for viewing the admin dashboard.-#-# This permission set provides access to view the admin dashboard-# and basic admin navigation.-#-# @example-# Spree.permissions.assign(:viewer, Spree::PermissionSets::DashboardDisplay)-#-module Spree- module PermissionSets- class DashboardDisplay < Base- def activate!- can [:admin, :index, :show], :dashboard- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/default_customer.rb b/spree/core/app/models/spree/permission_sets/default_customer.rbdeleted file mode 100644index 5e04bf1b72..0000000000--- a/spree/core/app/models/spree/permission_sets/default_customer.rb+++ /dev/null@@ -1,91 +0,0 @@-# Permission set for default storefront customers (both authenticated and guests).-#-# This permission set provides the standard permissions needed for browsing-# the store and making purchases.-#-# @example-# Spree.permissions.assign(:default, Spree::PermissionSets::DefaultCustomer)-#-module Spree- module PermissionSets- class DefaultCustomer < Base- def activate!- # Read-only access to catalog- can :read, Spree::Collection- can :read, Spree::Country- can :read, Spree::OptionType- can :read, Spree::OptionValue- can :read, Spree::Product- can :read, Spree::State- can :read, Spree::Store- can :read, Spree::Category- can :read, Spree::Variant- can :read, Spree::Zone-- # Content pages- can :read, Spree::Policy-- # Order management for the user's own orders- can :create, Spree::Order- can :show, Spree::Order do |order, token|- order.customer == user || order.token && token == order.token- end- can :update, Spree::Order do |order, token|- !order.completed? && (order.customer == user || order.token && token == order.token)- end-- # Cart management — the checkout owner since the cart/order split- can :create, Spree::Cart- can :show, Spree::Cart do |cart, token|- cart.customer == user || cart.token && token == cart.token- end- can [:update, :destroy], Spree::Cart do |cart, token|- !cart.completed? && (cart.customer == user || cart.token && token == cart.token)- end-- # Line item management- can :create, Spree::LineItem do |line_item, token|- owner = line_item.owner- owner.customer == user || owner.token && token == owner.token- end- can [:update, :destroy], Spree::LineItem do |line_item, token|- owner = line_item.owner- !owner.completed? && (owner.customer == user || owner.token && token == owner.token)- end-- # User account management - available to all users (including guests for their own record)- can :create, Spree.customer_class- can [:show, :update, :destroy], Spree.customer_class, id: user.id-- # Address management - only for persisted users with matching user_id- can :manage, Spree::Address, user_id: user.id if user.persisted?-- # Credit card management- can [:read, :destroy], Spree::CreditCard, user_id: user.id-- # Gift card management - users can view their own gift cards- can :read, Spree::GiftCard, user_id: user.id-- # Newsletter subscription management — customers manage their own newsletter subscribers- can [:show, :destroy], Spree::NewsletterSubscriber, user_id: user.id-- # Wishlist management- can :manage, Spree::Wishlist, user_id: user.id- can :show, Spree::Wishlist do |wishlist|- wishlist.customer == user || wishlist.is_private == false- end- can [:create, :update, :destroy], Spree::WishedItem do |wished_item|- wished_item.wishlist.customer == user- end-- # Invitation acceptance- can :accept, Spree::Invitation, invitee_id: [user.id, nil], invitee_type: user.class.name, status: 'pending'-- # Digital downloads - token-based access- can :show, Spree::DigitalLink do |digital_link, token|- digital_link.token == token- end- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/order_display.rb b/spree/core/app/models/spree/permission_sets/order_display.rbdeleted file mode 100644index 13d0bef4ee..0000000000--- a/spree/core/app/models/spree/permission_sets/order_display.rb+++ /dev/null@@ -1,29 +0,0 @@-# Permission set for viewing orders and related resources.-#-# This permission set provides read-only access to orders and associated-# models like payments, shipments, and refunds.-#-# @example-# Spree.permissions.assign(:customer_service, Spree::PermissionSets::OrderDisplay)-#-module Spree- module PermissionSets- class OrderDisplay < Base- def activate!- can [:read, :admin, :index], Spree::Order- can [:read, :admin], Spree::Payment- can [:read, :admin], Spree::Shipment- can [:read, :admin], Spree::TaxLine- can [:read, :admin], Spree::Discount- can [:read, :admin], Spree::Fee- can [:read, :admin], Spree::LineItem- can [:read, :admin], Spree::Return- can [:read, :admin], Spree::Exchange- can [:read, :admin], Spree::Claim- can [:read, :admin], Spree::Refund- can [:read, :admin], Spree::StoreCredit- can [:read, :admin], Spree::GiftCard- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/order_management.rb b/spree/core/app/models/spree/permission_sets/order_management.rbdeleted file mode 100644index c969c252c6..0000000000--- a/spree/core/app/models/spree/permission_sets/order_management.rb+++ /dev/null@@ -1,35 +0,0 @@-# Permission set for full order management.-#-# This permission set provides complete access to manage orders,-# including creating, updating, and processing payments and shipments.-#-# @example-# Spree.permissions.assign(:order_manager, Spree::PermissionSets::OrderManagement)-#-module Spree- module PermissionSets- class OrderManagement < Base- def activate!- can :manage, Spree::Order- can :manage, Spree::Payment- can :manage, Spree::Shipment- can :manage, Spree::TaxLine- can :manage, Spree::Discount- can :manage, Spree::Fee- can :manage, Spree::LineItem- can :manage, Spree::Return- can :manage, Spree::Exchange- can :manage, Spree::Claim- can :manage, Spree::Refund- can :manage, Spree::StoreCredit- can :manage, Spree::GiftCard-- # Order-specific restrictions- cannot :cancel, Spree::Order- can :cancel, Spree::Order, &:allow_cancel?- cannot :destroy, Spree::Order- can :destroy, Spree::Order, &:can_be_deleted?- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/product_display.rb b/spree/core/app/models/spree/permission_sets/product_display.rbdeleted file mode 100644index 3770814c5c..0000000000--- a/spree/core/app/models/spree/permission_sets/product_display.rb+++ /dev/null@@ -1,28 +0,0 @@-# Permission set for viewing products and catalog information.-#-# This permission set provides read-only access to products, variants,-# and related catalog models.-#-# @example-# Spree.permissions.assign(:content_editor, Spree::PermissionSets::ProductDisplay)-#-module Spree- module PermissionSets- class ProductDisplay < Base- def activate!- can [:read, :admin, :index], Spree::Product- can [:read, :admin], Spree::Variant- can [:read, :admin], Spree::OptionType- can [:read, :admin], Spree::ProductType- can [:read, :admin], Spree::OptionValue- can [:read, :admin], Spree::Metafield- can [:read, :admin], Spree::Collection- can [:read, :admin], Spree::Category- can [:read, :admin], Spree::ProductCategory- can [:read, :admin], Spree::Price- can [:read, :admin], Spree::PriceList- can [:read, :admin], Spree::PriceRule- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/product_management.rb b/spree/core/app/models/spree/permission_sets/product_management.rbdeleted file mode 100644index 46ed03954e..0000000000--- a/spree/core/app/models/spree/permission_sets/product_management.rb+++ /dev/null@@ -1,31 +0,0 @@-# Permission set for full product and catalog management.-#-# This permission set provides complete access to manage products, variants,-# and related catalog models like categories and properties.-#-# @example-# Spree.permissions.assign(:merchandiser, Spree::PermissionSets::ProductManagement)-#-module Spree- module PermissionSets- class ProductManagement < Base- def activate!- can :manage, Spree::Product- can :manage, Spree::ProductType- can :manage, Spree::Variant- can :manage, Spree::OptionType- can :manage, Spree::OptionValue- can :manage, Spree::Category- can :manage, Spree::ProductCategory- can :manage, Spree::Collection- can :manage, Spree::ProductCollection- can :manage, Spree::CollectionRule- can :manage, Spree::Price- can :manage, Spree::PriceList- can :manage, Spree::PriceRule- can :manage, Spree::Asset- can :manage, Spree::ProductPublication- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/promotion_management.rb b/spree/core/app/models/spree/permission_sets/promotion_management.rbdeleted file mode 100644index a1d7e5f33f..0000000000--- a/spree/core/app/models/spree/permission_sets/promotion_management.rb+++ /dev/null@@ -1,22 +0,0 @@-# Permission set for managing promotions and discounts.-#-# This permission set provides access to create and manage promotions,-# coupon codes, and promotion rules.-#-# @example-# Spree.permissions.assign(:marketing, Spree::PermissionSets::PromotionManagement)-#-module Spree- module PermissionSets- class PromotionManagement < Base- def activate!- can :manage, Spree::Promotion- can :manage, Spree::PromotionRule- can :manage, Spree::PromotionAction- can :manage, Spree::PromotionCategory- can :manage, Spree::CouponCode- can [:read, :admin], Spree::Metafield- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/role_management.rb b/spree/core/app/models/spree/permission_sets/role_management.rbdeleted file mode 100644index f817d94115..0000000000--- a/spree/core/app/models/spree/permission_sets/role_management.rb+++ /dev/null@@ -1,21 +0,0 @@-# Permission set for managing roles and permissions.-#-# This permission set provides access to manage roles and user assignments.-# Note: The admin role cannot be modified.-#-# @example-# Spree.permissions.assign(:admin, Spree::PermissionSets::RoleManagement)-#-module Spree- module PermissionSets- class RoleManagement < Base- def activate!- can :manage, Spree::Role- can :manage, Spree::RoleUser-- # Protect the admin role from modification- cannot [:update, :destroy], Spree::Role, name: ['admin']- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/stock_display.rb b/spree/core/app/models/spree/permission_sets/stock_display.rbdeleted file mode 100644index a123647493..0000000000--- a/spree/core/app/models/spree/permission_sets/stock_display.rb+++ /dev/null@@ -1,19 +0,0 @@-# Permission set for viewing stock and inventory information.-#-# This permission set provides read-only access to stock items,-# locations, and movements.-#-# @example-# Spree.permissions.assign(:warehouse_viewer, Spree::PermissionSets::StockDisplay)-#-module Spree- module PermissionSets- class StockDisplay < Base- def activate!- can [:read, :admin, :index], Spree::StockItem- can [:read, :admin], Spree::StockLocation- can [:read, :admin], Spree::StockMovement- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/stock_management.rb b/spree/core/app/models/spree/permission_sets/stock_management.rbdeleted file mode 100644index ac2e841bf3..0000000000--- a/spree/core/app/models/spree/permission_sets/stock_management.rb+++ /dev/null@@ -1,19 +0,0 @@-# Permission set for full stock and inventory management.-#-# This permission set provides complete access to manage stock items,-# locations, and movements.-#-# @example-# Spree.permissions.assign(:warehouse_manager, Spree::PermissionSets::StockManagement)-#-module Spree- module PermissionSets- class StockManagement < Base- def activate!- can :manage, Spree::StockItem- can :manage, Spree::StockLocation- can :manage, Spree::StockMovement- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/super_user.rb b/spree/core/app/models/spree/permission_sets/super_user.rbdeleted file mode 100644index cfc68a7571..0000000000--- a/spree/core/app/models/spree/permission_sets/super_user.rb+++ /dev/null@@ -1,26 +0,0 @@-# Permission set granting full administrative access.-#-# This permission set provides unrestricted access to all resources,-# with some safety restrictions for critical operations.-#-# @example-# Spree.permissions.assign(:admin, Spree::PermissionSets::SuperUser)-#-module Spree- module PermissionSets- class SuperUser < Base- def activate!- can :manage, :all-- # Safety restrictions- cannot :cancel, Spree::Order- can :cancel, Spree::Order, &:allow_cancel?- cannot :destroy, Spree::Order- can :destroy, Spree::Order, &:can_be_deleted?-- # Protect the admin role from modification- cannot [:update, :destroy], Spree::Role, name: ['admin']- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/user_display.rb b/spree/core/app/models/spree/permission_sets/user_display.rbdeleted file mode 100644index dc376642b5..0000000000--- a/spree/core/app/models/spree/permission_sets/user_display.rb+++ /dev/null@@ -1,19 +0,0 @@-# Permission set for viewing users and related information.-#-# This permission set provides read-only access to user accounts,-# addresses, and credit cards.-#-# @example-# Spree.permissions.assign(:support_staff, Spree::PermissionSets::UserDisplay)-#-module Spree- module PermissionSets- class UserDisplay < Base- def activate!- can [:read, :admin, :index], Spree.customer_class- can [:read, :admin], Spree::Address- can [:read, :admin], Spree::CreditCard- end- end- end-enddiff --git a/spree/core/app/models/spree/permission_sets/user_management.rb b/spree/core/app/models/spree/permission_sets/user_management.rbdeleted file mode 100644index b96f600417..0000000000--- a/spree/core/app/models/spree/permission_sets/user_management.rb+++ /dev/null@@ -1,20 +0,0 @@-# Permission set for full user management.-#-# This permission set provides complete access to manage user accounts,-# addresses, and credit cards.-#-# @example-# Spree.permissions.assign(:customer_service, Spree::PermissionSets::UserManagement)-#-module Spree- module PermissionSets- class UserManagement < Base- def activate!- can :manage, Spree.customer_class- can :manage, Spree::Address- can :manage, Spree::CreditCard- can [:read, :admin], Spree::Metafield- end- end- end-enddiff --git a/spree/core/app/models/spree/role.rb b/spree/core/app/models/spree/role.rbindex a413ec2532..1a23b3fe7e 100644--- a/spree/core/app/models/spree/role.rb+++ b/spree/core/app/models/spree/role.rb@@ -6,6 +6,16 @@ module SpreeADMIN_ROLE = 'admin'+ # Grantable capabilities as flat catalog keys (`read_orders`,+ # `write_products`, …) — see Spree::PermissionConfiguration. Stored as a+ # JSON array like Spree::ApiKey#scopes; the `admin` role ignores this and+ # always grants everything.+ attribute :permissions, default: []++ def permissions=(value)+ super(Array(value).map(&:to_s).reject(&:blank?).uniq)+ end+## Associations#@@ -14,6 +24,20 @@ module Spreehas_many :admin_users, through: :role_users, source: :user, source_type: Spree.admin_user_class.to_shas_many :invitations, class_name: 'Spree::Invitation', dependent: :destroy+ #+ # Validations+ #+ validate :permissions_must_be_known, if: :permissions_changed?+ validate :name_immutable, on: :update, if: :name_changed?+ validate :permissions_immutable, on: :update, if: :permissions_changed?++ #+ # Callbacks+ #+ # Prepended so the guard sees the role's assignments — `dependent: :destroy`+ # association callbacks would otherwise empty `role_users` before it runs.+ before_destroy :ensure_can_be_deleted, prepend: true+## Scopes#@@ -23,7 +47,62 @@ module Spree# Class Methods#def self.default_admin_role- find_or_create_by(name: ADMIN_ROLE)+ find_or_create_by(name: ADMIN_ROLE) do |role|+ role.mutable = false+ end+ end++ # The protected super-role. Guarded by name as well as the `mutable` flag+ # so a stale flag (e.g. a row predating the column) can never expose it.+ #+ # @return [Boolean]+ def admin?+ name == ADMIN_ROLE || name_was == ADMIN_ROLE+ end++ # Whether the dashboard may edit or delete this role. False for the admin+ # role and for host-locked rows (`mutable: false` via seeds/console).+ #+ # @return [Boolean]+ def mutable?+ super && !admin?+ end++ # A role can be deleted only when it is mutable and nothing references it:+ # staff assignments and pending invitations must be reassigned first.+ # Accepted or expired invitations are history and cascade on destroy.+ #+ # @return [Boolean]+ def can_be_deleted?+ mutable? && !role_users.exists? && !invitations.pending.exists?+ end++ private++ def permissions_must_be_known+ unknown = permissions - Spree.permissions.catalog_keys+ errors.add(:permissions, Spree.t(:role_permissions_unknown, keys: unknown.join(', '))) if unknown.any?+ end++ def name_immutable+ errors.add(:name, Spree.t(:role_immutable)) unless mutable_was_and_not_admin?+ end++ def permissions_immutable+ errors.add(:permissions, Spree.t(:role_immutable)) unless mutable_was_and_not_admin?+ end++ # Guards compare against the persisted state so flipping `mutable` in the+ # same save cannot smuggle a change past them.+ def mutable_was_and_not_admin?+ mutable_was && name_was != ADMIN_ROLE+ end++ def ensure_can_be_deleted+ return true if can_be_deleted?++ errors.add(:base, Spree.t(:role_cannot_be_deleted))+ throw :abortendendenddiff --git a/spree/core/app/services/spree/seeds/roles.rb b/spree/core/app/services/spree/seeds/roles.rbindex 2a9768d618..5150513080 100644--- a/spree/core/app/services/spree/seeds/roles.rb+++ b/spree/core/app/services/spree/seeds/roles.rb@@ -4,7 +4,8 @@ module Spreeprepend Spree::ServiceModule::Basedef call- Spree::Role.where(name: 'admin').first_or_create!+ admin = Spree::Role.where(name: Spree::Role::ADMIN_ROLE).first_or_create!+ admin.update_column(:mutable, false) if admin.read_attribute(:mutable)endendenddiff --git a/spree/core/config/locales/en.yml b/spree/core/config/locales/en.ymlindex 63115e6759..98e1e4535f 100644--- a/spree/core/config/locales/en.yml+++ b/spree/core/config/locales/en.yml@@ -1139,6 +1139,7 @@ en:or: ororder: Orderorder_canceled: Order canceled+ order_cannot_be_deleted: Completed orders and orders with settled payments cannot be deletedorder_mailer:cancel_email:dear_customer: Hey %{name},@@ -1209,6 +1210,70 @@ en:percent_per_item: Percent Per Itempermalink: Permalinkpermissions: Permissions+ permissions_catalog:+ groups:+ access: Access+ analytics: Analytics+ catalog: Catalog+ customers: Customers+ marketing: Marketing+ orders: Orders+ settings: Settings+ kinds:+ read: View+ write: Manage+ resources:+ api_keys:+ description: Create and revoke API credentials+ label: API keys+ categories:+ description: Category tree and taxonomies+ label: Categories+ collections:+ description: Manual and rule-based product collections+ label: Collections+ customers:+ description: Customer accounts, addresses, cards and groups+ label: Customers+ dashboard:+ description: Sales and performance analytics+ label: Analytics dashboard+ fulfillments:+ description: Pack, ship and track order fulfillments+ label: Fulfillments+ gift_cards:+ description: Gift cards and gift card batches+ label: Gift cards+ orders:+ description: Orders, line items, returns, exchanges and claims+ label: Orders+ payments:+ description: Order payments and payment capture+ label: Payments+ products:+ description: Products, variants, options, prices and media+ label: Products+ promotions:+ description: Promotions, rules and coupon codes+ label: Promotions+ refunds:+ description: Issue and view refunds+ label: Refunds+ settings:+ description: Store, payment, delivery, tax and channel configuration+ label: Store settings+ staff:+ description: Team members, invitations, roles and their permissions+ label: Staff & roles+ stock:+ description: Stock levels, locations, movements and transfers+ label: Inventory+ store_credits:+ description: Customer store credit balances+ label: Store credits+ webhooks:+ description: Webhook endpoints and deliveries+ label: Webhooksphone: Phonepolicies: Policiespowered_by: Powered by@@ -1367,7 +1432,10 @@ en:review: Reviewrisk: Riskrisky: Risky+ role_cannot_be_deleted: This role is protected or still referenced by staff members or pending invitations and cannot be deletedrole_id: Role ID+ role_immutable: cannot be changed on a protected role+ role_permissions_unknown: 'contains unknown permissions: %{keys}'roles: Rolesrow: Rowrules: Rulesdiff --git a/spree/core/db/migrate/20260807000001_add_permissions_to_spree_roles.rb b/spree/core/db/migrate/20260807000001_add_permissions_to_spree_roles.rbnew file mode 100644index 0000000000..ea54cc2f50--- /dev/null+++ b/spree/core/db/migrate/20260807000001_add_permissions_to_spree_roles.rb@@ -0,0 +1,14 @@+class AddPermissionsToSpreeRoles < ActiveRecord::Migration[8.1]+ def change+ change_table :spree_roles do |t|+ t.string :description+ t.boolean :mutable, default: true, null: false++ if t.respond_to?(:jsonb)+ t.jsonb :permissions+ else+ t.json :permissions+ end+ end+ end+enddiff --git a/spree/core/lib/spree/core.rb b/spree/core/lib/spree/core.rbindex 4310eea92b..147915affc 100644--- a/spree/core/lib/spree/core.rb+++ b/spree/core/lib/spree/core.rb@@ -520,18 +520,16 @@ module Spreeendend- # Permission configuration accessor for managing role-to-permission-set mappings.+ # The permission catalog — the grant vocabulary shared by staff roles and+ # secret API key scopes. Roles themselves are data (Spree::Role#permissions);+ # code only registers the vocabulary.#- # @example Assigning permission sets to a role- # Spree.permissions.assign(:customer_service, [- # Spree::PermissionSets::OrderDisplay,- # Spree::PermissionSets::UserManagement- # ])+ # @example Registering a resource from an extension+ # Spree.permissions.register_resource(:reviews, group: :catalog, subjects: -> {+ # [SpreeReviews::Review]+ # })#- # @example Clearing permission sets from a role- # Spree.permissions.clear(:customer_service)- #- # @return [Spree::PermissionConfiguration] the permission configuration instance+ # @return [Spree::PermissionConfiguration] the permission catalogdef self.permissions@permissions ||= PermissionConfiguration.newenddiff --git a/spree/core/lib/spree/core/permission_configuration.rb b/spree/core/lib/spree/core/permission_configuration.rbindex 308530f887..8a1d5081ff 100644--- a/spree/core/lib/spree/core/permission_configuration.rb+++ b/spree/core/lib/spree/core/permission_configuration.rb@@ -1,129 +1,274 @@-# Manages the mapping between roles and permission sets.+# The permission catalog — the single grant vocabulary shared by staff roles+# and secret API keys (see docs/plans/6.0-admin-rbac.md).#-# This configuration allows you to define which permission sets are assigned to each role.-# Permission sets are reusable groups of permissions that can be applied to roles.+# Code defines the vocabulary, data defines the roles: core and extensions+# register *resources* here, and each registration yields the grantable+# `read_<resource>` / `write_<resource>` keys. Roles store keys on their row+# (`Spree::Role#permissions`); API keys store them as scopes+# (`Spree::ApiKey#scopes`). There is no code-managed role concept.#-# @example Assigning permission sets to a role-# Spree.permissions.assign(:customer_service, [-# Spree::PermissionSets::OrderDisplay,-# Spree::PermissionSets::UserManagement-# ])-#-# @example Clearing permission sets from a role-# Spree.permissions.clear(:customer_service)-#-# @example Getting permission sets for a role-# Spree.permissions.permission_sets_for(:admin)-# # => [Spree::PermissionSets::SuperUser]+# @example Registering a resource from an extension+# Spree.permissions.register_resource(:reviews, group: :catalog, subjects: -> {+# [SpreeReviews::Review]+# })#module Spreeclass PermissionConfiguration- # Default role used for unauthenticated users- DEFAULT_ROLE = :default+ # Raised when a 5.x initializer still calls the removed permission-set API.+ class PermissionSetsRemovedError < StandardError; end++ READ_PREFIX = 'read_'.freeze+ WRITE_PREFIX = 'write_'.freeze++ # A registered catalog resource. Yields one or two grantable keys and maps+ # them to the CanCanCan subjects they cover.+ class Resource+ attr_reader :name, :group++ # @param name [Symbol] resource identifier (`:orders`)+ # @param group [Symbol] UI grouping for the permission pickers+ # @param subjects [Proc, Array] CanCanCan subjects covered by this+ # resource; pass a lambda so model classes resolve lazily+ # @param write [Boolean] whether a `write_<name>` key exists+ def initialize(name:, group:, subjects:, write: true)+ @name = name.to_sym+ @group = group.to_sym+ @subjects = subjects+ @write = write+ end- # Admin role with full access- ADMIN_ROLE = :admin+ # @return [Boolean]+ def write?+ @write+ end++ # @return [Array<Class, Symbol>]+ def subjects+ Array(@subjects.respond_to?(:call) ? @subjects.call : @subjects)+ end++ # @return [String]+ def read_key+ "#{READ_PREFIX}#{name}"+ end++ # @return [String, nil]+ def write_key+ "#{WRITE_PREFIX}#{name}" if write?+ end++ # @return [Array<String>] the grantable keys, read first+ def keys+ [read_key, write_key].compact+ end+ enddef initialize- @role_permissions = {}+ @resources = {}+ register_default_resourcesend- # Assigns permission sets to a role.+ # Registers a catalog resource, yielding its `read_<name>` (and, unless+ # `write: false`, `write_<name>`) keys. Re-registering a name replaces it.#- # @param role_name [Symbol, String] the name of the role- # @param permission_sets [Array<Class>, Class] permission set class(es) to assign- # @return [Array<Class>] the assigned permission sets- #- # @example- # Spree.permissions.assign(:customer_service, Spree::PermissionSets::OrderDisplay)- # Spree.permissions.assign(:admin, [- # Spree::PermissionSets::SuperUser- # ])- def assign(role_name, permission_sets)- role_key = normalize_role_name(role_name)- @role_permissions[role_key] ||= []- @role_permissions[role_key] |= Array(permission_sets)- end-- # Removes specific permission set(s) from a role.- #- # @param role_name [Symbol, String] the name of the role- # @param permission_sets [Array<Class>, Class] permission set class(es) to remove- # @return [Array<Class>] the remaining permission sets- def unassign(role_name, permission_sets)- role_key = normalize_role_name(role_name)- return [] unless @role_permissions[role_key]+ # @param name [Symbol, String]+ # @param group [Symbol] UI group (`:orders`, `:catalog`, `:marketing`,+ # `:customers`, `:settings`, `:access`, `:analytics` — or your own)+ # @param subjects [Proc, Array] CanCanCan subjects the keys grant+ # @param write [Boolean]+ # @return [Resource]+ def register_resource(name, group:, subjects:, write: true)+ resource = Resource.new(name: name, group: group, subjects: subjects, write: write)+ @resources[resource.name] = resource+ end- @role_permissions[role_key] -= Array(permission_sets)+ # @param name [Symbol, String]+ # @return [Resource, nil]+ def unregister_resource(name)+ @resources.delete(name.to_sym)end- # Clears all permission sets from a role.- #- # @param role_name [Symbol, String] the name of the role- # @return [Array<Class>] the removed permission sets- def clear(role_name)- role_key = normalize_role_name(role_name)- @role_permissions.delete(role_key)+ # @return [Array<Resource>] in registration order (drives UI ordering)+ def resources+ @resources.valuesend- # Returns the permission sets assigned to a role.- #- # @param role_name [Symbol, String] the name of the role- # @return [Array<Class>] the assigned permission sets- def permission_sets_for(role_name)- role_key = normalize_role_name(role_name)- @role_permissions[role_key] || []+ # @param name [Symbol, String]+ # @return [Resource, nil]+ def resource(name)+ @resources[name.to_s.to_sym]end- # Returns all permission sets for multiple roles.- #- # @param role_names [Array<Symbol, String>] the names of the roles- # @return [Array<Class>] the combined permission sets (deduplicated)- def permission_sets_for_roles(role_names)- role_names.flat_map { |role_name| permission_sets_for(role_name) }.uniq+ # One grantable key with its kind and owning resource — the unit the+ # `/admin/permissions` discovery endpoint serializes.+ class Entry+ attr_reader :key, :kind, :resource++ def initialize(key:, kind:, resource:)+ @key = key+ @kind = kind+ @resource = resource+ end+ end++ # @return [Array<String>] every grantable key, in registration order+ def catalog_keys+ resources.flat_map(&:keys)end- # Returns all configured roles.+ # @return [Array<Entry>] every grantable key with metadata, in catalog order+ def entries+ resources.flat_map do |resource|+ resource.keys.map do |key|+ Entry.new(key: key, kind: key.start_with?(WRITE_PREFIX) ? :write : :read, resource: resource)+ end+ end+ end++ # @param key [String, Symbol]+ # @return [Boolean]+ def key?(key)+ !resolve_key(key).nil?+ end++ # Resolves a key into its kind and resource.#- # @return [Array<Symbol>] the configured role names- def roles- @role_permissions.keys+ # @param key [String, Symbol]+ # @return [Array(Symbol, Resource), nil] `[:read | :write, resource]`+ def resolve_key(key)+ key = key.to_s+ if key.start_with?(WRITE_PREFIX)+ found = resource(key.delete_prefix(WRITE_PREFIX))+ [:write, found] if found&.write?+ elsif key.start_with?(READ_PREFIX)+ found = resource(key.delete_prefix(READ_PREFIX))+ [:read, found] if found+ endend- # Checks if a role has any permission sets assigned.+ # Applies one key's grants to a CanCanCan ability. Read keys grant+ # `[:read, :admin]`; write keys grant `:manage` (which covers read).#- # @param role_name [Symbol, String] the name of the role- # @return [Boolean]- def role_configured?(role_name)- role_key = normalize_role_name(role_name)- @role_permissions.key?(role_key) && @role_permissions[role_key].any?+ # @param ability [CanCan::Ability]+ # @param key [String, Symbol]+ # @return [Boolean] whether the key resolved and was applied+ def activate_key(ability, key)+ kind, found = resolve_key(key)+ return false unless found++ found.subjects.each do |subject|+ if kind == :write+ ability.can(:manage, subject)+ else+ ability.can(%i[read admin], subject)+ end+ end+ trueend- # Resets all role permissions to empty state.- # Useful for testing.- def reset!- @role_permissions = {}+ # Expands a key list into the full set of keys it effectively grants:+ # `write_x` implies `read_x`, and the `read_all` / `write_all` API-key+ # aliases expand against the whole catalog. Unknown keys are dropped.+ # Result preserves catalog order.+ #+ # @param keys [Array<String, Symbol>]+ # @return [Array<String>]+ def expand_keys(keys)+ keys = Array(keys).map(&:to_s)+ return catalog_keys if keys.include?('write_all')++ effective = keys.include?('read_all') ? resources.map(&:read_key) : []+ effective |= keys.flat_map do |key|+ kind, found = resolve_key(key)+ next [] unless found++ kind == :write ? [found.write_key, found.read_key] : [found.read_key]+ end+ catalog_keys & effectiveend- # Returns a deep copy of this configuration. Useful for snapshotting- # state before a test mutates it; restore with {#replace}.- def dup- copy = super- copy.instance_variable_set(:@role_permissions, @role_permissions.deep_dup)- copy+ # Restores the catalog to core defaults. Useful for tests that register+ # extra resources.+ def reset!+ @resources = {}+ register_default_resourcesend- # Replaces this configuration's state with a deep copy of `other`'s.- # Pair with {#dup} to snapshot/restore around code that mutates the- # global Spree.permissions config.- def replace(other)- @role_permissions = other.instance_variable_get(:@role_permissions).deep_dup+ # Removed in 6.0 — roles are data now (see docs/plans/6.0-admin-rbac.md).+ # Kept only to fail loudly with directions instead of a bare NoMethodError.+ def assign(*)+ raise PermissionSetsRemovedError,+ 'Permission sets were removed in Spree 6.0. Create roles and edit their ' \+ 'permissions in the dashboard (Settings → Roles), via the Admin API, or in ' \+ 'seeds (`Spree::Role#permissions` holds catalog keys). For record-level ' \+ 'custom rules use Spree::Ability.register_ability. ' \+ 'See https://spreecommerce.org/docs/developer/customization/permissions'endprivate- def normalize_role_name(role_name)- role_name.to_s.downcase.to_sym+ # The core vocabulary — one entry per Admin API scope resource. Subjects+ # are lambdas so model classes resolve at activation, not load, time.+ # rubocop:disable Metrics/MethodLength+ def register_default_resources+ register_resource(:orders, group: :orders, subjects: -> {+ [Spree::Order, Spree::LineItem, Spree::TaxLine, Spree::Discount, Spree::Fee,+ Spree::Return, Spree::Exchange, Spree::Claim, Spree::Metafield]+ })+ register_resource(:payments, group: :orders, subjects: -> { [Spree::Payment] })+ register_resource(:fulfillments, group: :orders, subjects: -> { [Spree::Fulfillment] })+ register_resource(:refunds, group: :orders, subjects: -> { [Spree::Refund] })+ register_resource(:gift_cards, group: :orders, subjects: -> {+ [Spree::GiftCard, Spree::GiftCardBatch]+ })+ register_resource(:store_credits, group: :orders, subjects: -> { [Spree::StoreCredit] })++ register_resource(:products, group: :catalog, subjects: -> {+ [Spree::Product, Spree::ProductType, Spree::Variant, Spree::OptionType,+ Spree::OptionValue, Spree::Price, Spree::PriceList, Spree::PriceRule,+ Spree::Asset, Spree::ProductPublication, Spree::Metafield]+ })+ register_resource(:categories, group: :catalog, subjects: -> {+ [Spree::Category, Spree::Taxonomy, Spree::ProductCategory]+ })+ register_resource(:collections, group: :catalog, subjects: -> {+ [Spree::Collection, Spree::ProductCollection, Spree::CollectionRule]+ })+ register_resource(:stock, group: :catalog, subjects: -> {+ [Spree::StockItem, Spree::StockLocation, Spree::StockMovement,+ Spree::StockTransfer, Spree::StockReservation]+ })++ register_resource(:promotions, group: :marketing, subjects: -> {+ [Spree::Promotion, Spree::PromotionRule, Spree::PromotionAction,+ Spree::PromotionCategory, Spree::CouponCode, Spree::Metafield]+ })++ register_resource(:customers, group: :customers, subjects: -> {+ [Spree.customer_class, Spree::Address, Spree::CreditCard, Spree::CustomerGroup,+ Spree::Metafield]+ })++ register_resource(:settings, group: :settings, subjects: -> {+ [Spree::Store, Spree::PaymentMethod, Spree::Gateway, Spree::DeliveryMethod,+ Spree::DeliveryMethodRule, Spree::DeliveryZone, Spree::DeliveryZoneMember,+ Spree::StockLocation, Spree::ShippingCategory, Spree::Zone, Spree::ZoneMember,+ Spree::Market, Spree::TaxCategory, Spree::TaxRate, Spree::AllowedOrigin,+ Spree::RefundReason, Spree::ReturnReason, Spree::ClaimReason, Spree::Channel,+ Spree::OrderRoutingRule, Spree::MetafieldDefinition, Spree::Policy,+ Spree::StoreCreditCategory]+ })+ register_resource(:webhooks, group: :settings, subjects: -> {+ [Spree::WebhookEndpoint, Spree::WebhookDelivery]+ })++ register_resource(:api_keys, group: :access, subjects: -> { [Spree::ApiKey] })+ register_resource(:staff, group: :access, subjects: -> {+ [Spree.admin_user_class, Spree::Invitation, Spree::Role, Spree::RoleUser]+ })++ register_resource(:dashboard, group: :analytics, subjects: -> { [:dashboard] }, write: false)end+ # rubocop:enable Metrics/MethodLengthendenddiff --git a/spree/core/spec/lib/spree/core/permission_configuration_spec.rb b/spree/core/spec/lib/spree/core/permission_configuration_spec.rbindex 44848dbcaa..41736e6482 100644--- a/spree/core/spec/lib/spree/core/permission_configuration_spec.rb+++ b/spree/core/spec/lib/spree/core/permission_configuration_spec.rb@@ -1,170 +1,151 @@require 'spec_helper'+require 'cancan'RSpec.describe Spree::PermissionConfiguration do- subject(:config) { described_class.new }+ subject(:configuration) { described_class.new }- # Create test permission set classes- let(:permission_set_a) { Class.new(Spree::PermissionSets::Base) { def activate!; can :read, Spree::Order; end } }- let(:permission_set_b) { Class.new(Spree::PermissionSets::Base) { def activate!; can :manage, Spree::Order; end } }- let(:permission_set_c) { Class.new(Spree::PermissionSets::Base) { def activate!; can :read, Spree::Product; end } }-- describe '#assign' do- it 'assigns a single permission set to a role' do- config.assign(:customer_service, permission_set_a)-- expect(config.permission_sets_for(:customer_service)).to contain_exactly(permission_set_a)+ describe 'default catalog' do+ it 'registers the core resources' do+ expect(configuration.resource(:orders)).to be_present+ expect(configuration.resource(:products)).to be_present+ expect(configuration.resource(:staff)).to be_present+ expect(configuration.resource(:dashboard)).to be_presentend- it 'assigns multiple permission sets to a role' do- config.assign(:customer_service, [permission_set_a, permission_set_b])-- expect(config.permission_sets_for(:customer_service)).to contain_exactly(permission_set_a, permission_set_b)+ it 'yields read and write keys per resource' do+ expect(configuration.catalog_keys).to include('read_orders', 'write_orders', 'read_staff', 'write_staff')end- it 'adds to existing permission sets when called multiple times' do- config.assign(:customer_service, permission_set_a)- config.assign(:customer_service, permission_set_b)-- expect(config.permission_sets_for(:customer_service)).to contain_exactly(permission_set_a, permission_set_b)+ it 'yields no write key for read-only resources' do+ expect(configuration.catalog_keys).to include('read_dashboard')+ expect(configuration.catalog_keys).not_to include('write_dashboard')end+ end- it 'does not duplicate permission sets' do- config.assign(:customer_service, permission_set_a)- config.assign(:customer_service, permission_set_a)+ describe '#register_resource' do+ it 'registers a resource with lazy subjects and yields its keys' do+ configuration.register_resource(:reviews, group: :catalog, subjects: -> { [Spree::Product] })- expect(config.permission_sets_for(:customer_service)).to contain_exactly(permission_set_a)+ expect(configuration.catalog_keys).to include('read_reviews', 'write_reviews')+ expect(configuration.resource(:reviews).subjects).to eq([Spree::Product])+ expect(configuration.resource(:reviews).group).to eq(:catalog)end- it 'normalizes role names to symbols' do- config.assign('Customer_Service', permission_set_a)+ it 'replaces an existing registration with the same name' do+ configuration.register_resource(:reviews, group: :catalog, subjects: [Spree::Product])+ configuration.register_resource(:reviews, group: :marketing, subjects: [Spree::Order])- expect(config.permission_sets_for(:customer_service)).to contain_exactly(permission_set_a)+ expect(configuration.resource(:reviews).group).to eq(:marketing)endend- describe '#unassign' do- it 'removes a specific permission set from a role' do- config.assign(:customer_service, [permission_set_a, permission_set_b])- config.unassign(:customer_service, permission_set_a)+ describe '#unregister_resource' do+ it 'removes the resource and its keys' do+ configuration.register_resource(:reviews, group: :catalog, subjects: [Spree::Product])+ configuration.unregister_resource(:reviews)- expect(config.permission_sets_for(:customer_service)).to contain_exactly(permission_set_b)+ expect(configuration.resource(:reviews)).to be_nil+ expect(configuration.catalog_keys).not_to include('read_reviews')end+ end- it 'removes multiple permission sets from a role' do- config.assign(:customer_service, [permission_set_a, permission_set_b, permission_set_c])- config.unassign(:customer_service, [permission_set_a, permission_set_c])+ describe '#resolve_key' do+ it 'resolves read and write keys' do+ kind, resource = configuration.resolve_key('write_orders')+ expect(kind).to eq(:write)+ expect(resource.name).to eq(:orders)- expect(config.permission_sets_for(:customer_service)).to contain_exactly(permission_set_b)+ kind, resource = configuration.resolve_key('read_gift_cards')+ expect(kind).to eq(:read)+ expect(resource.name).to eq(:gift_cards)end- it 'returns an empty array for non-existent roles' do- expect(config.unassign(:nonexistent, permission_set_a)).to eq([])+ it 'returns nil for unknown keys' do+ expect(configuration.resolve_key('write_bogus')).to be_nil+ expect(configuration.resolve_key('read_bogus')).to be_nil+ expect(configuration.resolve_key('bogus')).to be_nilend- it 'normalizes role names' do- config.assign(:customer_service, [permission_set_a, permission_set_b])- config.unassign('Customer_Service', permission_set_a)-- expect(config.permission_sets_for(:customer_service)).to contain_exactly(permission_set_b)+ it 'returns nil for a write key on a read-only resource' do+ expect(configuration.resolve_key('write_dashboard')).to be_nilendend- describe '#clear' do- it 'removes all permission sets from a role' do- config.assign(:customer_service, [permission_set_a, permission_set_b])- config.clear(:customer_service)-- expect(config.permission_sets_for(:customer_service)).to be_empty- end-- it 'returns the removed permission sets' do- config.assign(:customer_service, [permission_set_a, permission_set_b])+ describe '#activate_key' do+ let(:ability_class) do+ Class.new do+ include CanCan::Ability- expect(config.clear(:customer_service)).to contain_exactly(permission_set_a, permission_set_b)+ def initialize; end+ endend+ let(:ability) { ability_class.new }- it 'returns nil for non-existent roles' do- expect(config.clear(:nonexistent)).to be_nil- end- end+ it 'grants read and admin for a read key' do+ configuration.activate_key(ability, 'read_orders')- describe '#permission_sets_for' do- it 'returns an empty array for non-configured roles' do- expect(config.permission_sets_for(:unknown)).to eq([])+ expect(ability.can?(:read, Spree::Order)).to be true+ expect(ability.can?(:admin, Spree::Order)).to be true+ expect(ability.can?(:update, Spree::Order)).to be falseend- it 'returns the assigned permission sets' do- config.assign(:admin, permission_set_a)+ it 'grants manage for a write key' do+ configuration.activate_key(ability, 'write_orders')- expect(config.permission_sets_for(:admin)).to contain_exactly(permission_set_a)+ expect(ability.can?(:manage, Spree::Order)).to be trueend- it 'normalizes role names' do- config.assign(:admin, permission_set_a)-- expect(config.permission_sets_for('ADMIN')).to contain_exactly(permission_set_a)+ it 'returns false for unknown keys' do+ expect(configuration.activate_key(ability, 'write_bogus')).to be falseendend- describe '#permission_sets_for_roles' do- it 'combines permission sets from multiple roles' do- config.assign(:admin, permission_set_a)- config.assign(:merchandiser, permission_set_b)-- expect(config.permission_sets_for_roles([:admin, :merchandiser])).to contain_exactly(permission_set_a, permission_set_b)+ describe '#expand_keys' do+ it 'expands write keys to include the read key' do+ expect(configuration.expand_keys(%w[write_orders])).to eq(%w[read_orders write_orders])end- it 'deduplicates permission sets shared across roles' do- config.assign(:admin, permission_set_a)- config.assign(:merchandiser, [permission_set_a, permission_set_b])-- expect(config.permission_sets_for_roles([:admin, :merchandiser])).to contain_exactly(permission_set_a, permission_set_b)+ it 'keeps read keys as-is' do+ expect(configuration.expand_keys(%w[read_orders])).to eq(%w[read_orders])end- it 'returns empty array when no roles have permission sets' do- expect(config.permission_sets_for_roles([:unknown1, :unknown2])).to eq([])+ it 'drops unknown keys' do+ expect(configuration.expand_keys(%w[read_orders bogus write_nothing])).to eq(%w[read_orders])end- end- describe '#roles' do- it 'returns all configured roles' do- config.assign(:admin, permission_set_a)- config.assign(:customer_service, permission_set_b)-- expect(config.roles).to contain_exactly(:admin, :customer_service)+ it 'expands write_all to the whole catalog' do+ expect(configuration.expand_keys(%w[write_all])).to eq(configuration.catalog_keys)end- it 'returns empty array when no roles are configured' do- expect(config.roles).to eq([])- end- end+ it 'expands read_all to every read key' do+ expanded = configuration.expand_keys(%w[read_all])- describe '#role_configured?' do- it 'returns true for configured roles' do- config.assign(:admin, permission_set_a)-- expect(config.role_configured?(:admin)).to be true+ expect(expanded).to include('read_orders', 'read_products', 'read_dashboard')+ expect(expanded.grep(/\Awrite_/)).to be_emptyend- it 'returns false for non-configured roles' do- expect(config.role_configured?(:unknown)).to be false+ it 'preserves catalog order' do+ expect(configuration.expand_keys(%w[write_products read_orders])).to eq(+ %w[read_orders read_products write_products]+ )end+ end- it 'returns false for cleared roles' do- config.assign(:admin, permission_set_a)- config.clear(:admin)+ describe '#reset!' do+ it 'restores the default catalog' do+ configuration.register_resource(:reviews, group: :catalog, subjects: [Spree::Product])+ configuration.reset!- expect(config.role_configured?(:admin)).to be false+ expect(configuration.resource(:reviews)).to be_nil+ expect(configuration.resource(:orders)).to be_presentendend- describe '#reset!' do- it 'clears all role permissions' do- config.assign(:admin, permission_set_a)- config.assign(:customer_service, permission_set_b)- config.reset!-- expect(config.roles).to eq([])+ describe '#assign' do+ it 'raises with upgrade directions — permission sets were removed in 6.0' do+ expect { configuration.assign(:admin, []) }.to raise_error(+ Spree::PermissionConfiguration::PermissionSetsRemovedError, /removed in Spree 6\.0/+ )endendenddiff --git a/spree/core/spec/models/spree/ability_spec.rb b/spree/core/spec/models/spree/ability_spec.rbindex 132e1f0412..887b13ed47 100644--- a/spree/core/spec/models/spree/ability_spec.rb+++ b/spree/core/spec/models/spree/ability_spec.rb@@ -12,11 +12,7 @@ describe Spree::Ability, type: :model dolet(:resource) { Object.new }context 'with admin user' do- before do- allow(user).to receive(:persisted?).and_return(true)- allow(user).to receive(:spree_roles).and_return(Spree::Role.where(name: 'admin'))- allow(user).to receive(:spree_admin?).and_return(true)- end+ let(:user) { create(:admin_user) }it_behaves_like 'access granted'it_behaves_like 'index allowed'@@ -30,19 +26,15 @@ describe Spree::Ability, type: :model docontext 'for admin protected resources' dolet(:resource) { Object.new }- let(:resource_shipment) { Spree::Shipment.new }let(:resource_product) { store.products.new }let(:resource_user) { create(:user) }let(:resource_order) { create(:order, customer: resource_user) }- let(:fakedispatch_user) { create(:user) }- let(:fakedispatch_ability) { Spree::Ability.new(fakedispatch_user) }context 'with admin user' docontext 'admin user role' do+ let(:user) { create(:admin_user) }+it 'is able to admin' do- allow(user).to receive(:persisted?).and_return(true)- allow(user).to receive(:spree_roles).and_return(Spree::Role.where(name: 'admin'))- allow(user).to receive(:spree_admin?).and_return(true)expect(ability).to be_able_to :admin, resourceexpect(ability).to be_able_to :index, resource_orderexpect(ability).to be_able_to :show, resource_product@@ -50,20 +42,18 @@ describe Spree::Ability, type: :model doendend- context 'admin user class' do+ context 'admin user class with no role rows (spree_admin? fallback)' dolet(:user) { Spree::DummyModel.create(name: 'admin') }before do@original_admin_user_class = Spree.admin_user_class(constantize: false)Spree.admin_user_class = 'Spree::DummyModel'+ allow(user).to receive(:spree_admin?).and_return(true)endafter { Spree.admin_user_class = @original_admin_user_class }it 'is able to admin' do- allow(user).to receive(:persisted?).and_return(true)- allow(user).to receive(:spree_roles).and_return(Spree::Role.where(name: 'admin'))- allow(user).to receive(:spree_admin?).and_return(true)expect(ability).to be_able_to :admin, resourceexpect(ability).to be_able_to :index, resource_orderexpect(ability).to be_able_to :show, resource_product@@ -79,6 +69,111 @@ describe Spree::Ability, type: :model doexpect(ability).not_to be_able_to :admin, resource_productexpect(ability).not_to be_able_to :admin, resource_userend++ it 'is not able to admin even with an admin role assignment' do+ user.save!+ user.spree_roles << Spree::Role.default_admin_role++ expect(Spree::Ability.new(user)).not_to be_able_to :admin, resource+ end+ end+ end++ describe 'staff permissions from catalog keys' do+ let(:admin) { create(:admin_user, :without_admin_role) }+ let(:staff_ability) { Spree::Ability.new(admin, store: store) }++ context 'with a role granting a read key' do+ before do+ admin.role_users.create!(role: create(:role, name: 'viewer', permissions: %w[read_orders]), resource: store)+ end++ it 'grants read and admin on the resource subjects' do+ expect(staff_ability).to be_able_to :read, Spree::Order.new+ expect(staff_ability).to be_able_to :admin, Spree::Order.new+ expect(staff_ability).not_to be_able_to :update, Spree::Order.new+ end++ it 'does not grant other resources' do+ expect(staff_ability).not_to be_able_to :read, store.products.new+ end++ it 'reports the expanded permission keys' do+ expect(staff_ability.permission_keys).to eq(%w[read_orders])+ end+ end++ context 'with a role granting a write key' do+ before do+ admin.role_users.create!(role: create(:role, name: 'manager', permissions: %w[write_orders]), resource: store)+ end++ it 'grants manage on the resource subjects' do+ expect(staff_ability).to be_able_to :manage, Spree::Order.new+ expect(staff_ability).to be_able_to :read, Spree::Order.new+ end++ it 'reports write and implied read keys' do+ expect(staff_ability.permission_keys).to eq(%w[read_orders write_orders])+ end+ end++ context 'with multiple roles' do+ before do+ admin.role_users.create!(role: create(:role, name: 'support', permissions: %w[read_orders]), resource: store)+ admin.role_users.create!(role: create(:role, name: 'merch', permissions: %w[write_products]), resource: store)+ end++ it 'combines keys from all roles' do+ expect(staff_ability).to be_able_to :read, Spree::Order.new+ expect(staff_ability).to be_able_to :manage, store.products.new+ expect(staff_ability).not_to be_able_to :update, Spree::Order.new+ end+ end++ context 'with a role granting no keys' do+ before do+ admin.role_users.create!(role: create(:role, name: 'empty'), resource: store)+ end++ it 'grants only the staff baseline' do+ expect(staff_ability).not_to be_able_to :read, Spree::Order.new+ expect(staff_ability).not_to be_able_to :manage, store.products.new+ expect(staff_ability).to be_able_to :read, Spree::Country.new+ expect(staff_ability).to be_able_to :read, Spree::State.new+ expect(staff_ability).to be_able_to :read, store+ end+ end++ context 'with the admin role' do+ before do+ admin.role_users.create!(role: Spree::Role.default_admin_role, resource: store)+ end++ it 'grants everything and reports the full catalog' do+ expect(staff_ability).to be_able_to :manage, :all+ expect(staff_ability.permission_keys).to eq(Spree.permissions.catalog_keys)+ end+ end+ end++ describe '.register_ability' do+ let(:custom_ability_class) do+ Class.new do+ include CanCan::Ability++ def initialize(user)+ can :read, Spree::Order if user+ end+ end+ end++ after { Spree::Ability.remove_ability(custom_ability_class) }++ it 'merges registered ability rules into every ability' do+ Spree::Ability.register_ability(custom_ability_class)++ expect(Spree::Ability.new(create(:user))).to be_able_to :read, Spree::Order.newendenddiff --git a/spree/core/spec/models/spree/ability_storefront_spec.rb b/spree/core/spec/models/spree/ability_storefront_spec.rbnew file mode 100644index 0000000000..9788c1b5e4--- /dev/null+++ b/spree/core/spec/models/spree/ability_storefront_spec.rb@@ -0,0 +1,200 @@+require 'spec_helper'+require 'cancan/matchers'++# The fixed storefront baseline customers and guests get from Spree::Ability —+# formerly the DefaultCustomer permission set, now internal ability code.+RSpec.describe Spree::Ability, 'storefront baseline', type: :model do+ let(:user) { create(:user) }+ let(:ability) { Spree::Ability.new(user) }++ context 'catalog read access' do+ it 'grants read access to Country' do+ expect(ability.can?(:read, Spree::Country)).to be true+ end++ it 'grants read access to Product' do+ expect(ability.can?(:read, Spree::Product)).to be true+ end++ it 'grants read access to Variant' do+ expect(ability.can?(:read, Spree::Variant)).to be true+ end++ it 'grants read access to Category' do+ expect(ability.can?(:read, Spree::Category)).to be true+ end++ it 'grants read access to Store' do+ expect(ability.can?(:read, Spree::Store)).to be true+ end+ end++ context 'order permissions' do+ it 'allows creating orders' do+ expect(ability.can?(:create, Spree::Order)).to be true+ end++ context 'with user order' do+ let(:order) { build(:order, customer: user) }++ it 'allows viewing own order' do+ expect(ability.can?(:show, order)).to be true+ end++ it 'allows updating own incomplete order' do+ allow(order).to receive(:completed?).and_return(false)+ expect(ability.can?(:update, order)).to be true+ end++ it 'prevents updating own completed order' do+ allow(order).to receive(:completed?).and_return(true)+ expect(ability.can?(:update, order)).to be false+ end+ end++ context 'with token' do+ let(:order) { build(:order, customer: nil, token: 'secret') }++ it 'allows viewing order with correct token' do+ expect(ability.can?(:show, order, 'secret')).to be true+ end++ it 'allows updating incomplete order with correct token' do+ allow(order).to receive(:completed?).and_return(false)+ expect(ability.can?(:update, order, 'secret')).to be true+ end++ it 'prevents viewing order with incorrect token' do+ expect(ability.can?(:show, order, 'wrong')).to be false+ end+ end+ end++ context 'user account permissions' do+ it 'allows viewing own user' do+ expect(ability.can?(:show, user)).to be true+ end++ it 'allows updating own user' do+ expect(ability.can?(:update, user)).to be true+ end++ it 'allows destroying own user' do+ expect(ability.can?(:destroy, user)).to be true+ end++ it 'prevents viewing other user' do+ other_user = create(:user)+ expect(ability.can?(:show, other_user)).to be false+ end++ it 'allows creating new user' do+ expect(ability.can?(:create, Spree.customer_class)).to be true+ end+ end++ context 'with non-persisted user' do+ let(:guest_user) { build(:user) }+ let(:guest_ability) { Spree::Ability.new(guest_user) }++ it 'allows viewing self' do+ expect(guest_ability.can?(:show, guest_user)).to be true+ end++ it 'allows updating self' do+ expect(guest_ability.can?(:update, guest_user)).to be true+ end+ end++ context 'address permissions' do+ let(:own_address) { build(:address, user_id: user.id) }+ let(:other_address) { build(:address, user_id: create(:user).id) }++ it 'allows managing own address' do+ expect(ability.can?(:manage, own_address)).to be true+ end++ it 'prevents managing other user address' do+ expect(ability.can?(:manage, other_address)).to be false+ end++ context 'with guest user (non-persisted)' do+ let(:guest_user) { Spree.customer_class.new }+ let(:guest_ability) { Spree::Ability.new(guest_user) }+ let(:guest_address) { build(:address, user_id: nil) }+ let(:other_guest_address) { create(:address, user_id: nil) }++ it 'prevents guest user from managing addresses with nil user_id (IDOR protection)' do+ expect(guest_ability.can?(:manage, guest_address)).to be false+ end++ it 'prevents guest user from editing other guest addresses (IDOR protection)' do+ expect(guest_ability.can?(:edit, other_guest_address)).to be false+ end++ it 'prevents guest user from updating other guest addresses (IDOR protection)' do+ expect(guest_ability.can?(:update, other_guest_address)).to be false+ end++ it 'prevents guest user from reading other guest addresses (IDOR protection)' do+ expect(guest_ability.can?(:read, other_guest_address)).to be false+ end+ end+ end++ context 'credit card permissions' do+ let(:own_card) { build(:credit_card, user_id: user.id) }+ let(:other_card) { build(:credit_card, user_id: create(:user).id) }++ it 'allows reading own credit card' do+ expect(ability.can?(:read, own_card)).to be true+ end++ it 'allows destroying own credit card' do+ expect(ability.can?(:destroy, own_card)).to be true+ end++ it 'prevents reading other user credit card' do+ expect(ability.can?(:read, other_card)).to be false+ end+ end++ context 'wishlist permissions' do+ let(:own_wishlist) { build(:wishlist, customer: user) }+ let(:public_wishlist) { build(:wishlist, customer: create(:user), is_private: false) }+ let(:private_wishlist) { build(:wishlist, customer: create(:user), is_private: true) }++ it 'allows managing own wishlist' do+ expect(ability.can?(:manage, own_wishlist)).to be true+ end++ it 'allows viewing public wishlist' do+ expect(ability.can?(:show, public_wishlist)).to be true+ end++ it 'prevents viewing private wishlist' do+ expect(ability.can?(:show, private_wishlist)).to be false+ end+ end++ context 'admin permissions' do+ it 'does not grant admin access' do+ expect(ability.can?(:admin, :all)).to be false+ end++ it 'does not grant manage access to Product' do+ expect(ability.can?(:manage, Spree::Product)).to be false+ end++ it 'never resolves roles for customer principals' do+ role = create(:role, name: 'support', permissions: %w[write_orders])+ user.spree_roles << role++ expect(Spree::Ability.new(user).can?(:manage, Spree::Order)).to be false+ end+ end++ it 'reports no permission keys' do+ expect(ability.permission_keys).to eq([])+ end+enddiff --git a/spree/core/spec/models/spree/order_spec.rb b/spree/core/spec/models/spree/order_spec.rbindex 42c291a7ac..1895abf994 100644--- a/spree/core/spec/models/spree/order_spec.rb+++ b/spree/core/spec/models/spree/order_spec.rb@@ -888,6 +888,22 @@ describe Spree::Order, type: :model doendend+ describe '#destroy record-state guard' do+ it 'refuses to destroy a completed order' do+ order = create(:completed_order_with_pending_payment)++ expect(order.destroy).to be false+ expect(order.errors[:base]).to be_present+ expect(order.reload).to be_persisted+ end++ it 'destroys an incomplete order without settled payments' do+ order = create(:order)++ expect(order.destroy).to be_truthy+ end+ end+describe '#uneditable?' dolet(:order) { create(:order) }diff --git a/spree/core/spec/models/spree/permission_sets/ability_integration_spec.rb b/spree/core/spec/models/spree/permission_sets/ability_integration_spec.rbdeleted file mode 100644index 47f985fbaa..0000000000--- a/spree/core/spec/models/spree/permission_sets/ability_integration_spec.rb+++ /dev/null@@ -1,146 +0,0 @@-require 'spec_helper'-require 'cancan/matchers'--RSpec.describe 'Permission Sets Integration with Ability', type: :model do- let(:store) { @default_store }-- # These specs configure Spree.permissions from scratch to assert exact role- # resolution, but the config is global — leaving it empty would strip admins- # of `accessible_by(:manage)` in every spec that runs after this file.- around do |example|- saved = Spree.permissions.dup- Spree.permissions.reset!- example.run- ensure- Spree.permissions.replace(saved)- end-- describe 'role-based permissions' do- let(:customer_service_permission_set) do- Class.new(Spree::PermissionSets::Base) do- def activate!- can [:read, :admin], Spree::Order- can [:read, :admin], Spree.customer_class- end- end- end-- let(:merchandiser_permission_set) do- Class.new(Spree::PermissionSets::Base) do- def activate!- can :manage, Spree::Product- can :manage, Spree::Variant- end- end- end-- context 'user with single role' do- let(:role) { create(:role, name: 'customer_service') }- let(:user) { create(:user) }-- before do- user.spree_roles << role- Spree.permissions.assign(:customer_service, customer_service_permission_set)- end-- it 'applies the permission sets for the role' do- ability = Spree::Ability.new(user)-- expect(ability.can?(:read, Spree::Order)).to be true- expect(ability.can?(:admin, Spree::Order)).to be true- expect(ability.can?(:manage, Spree::Product)).to be false- end- end-- context 'user with multiple roles' do- let(:cs_role) { create(:role, name: 'customer_service') }- let(:merch_role) { create(:role, name: 'merchandiser') }- let(:user) { create(:user) }-- before do- user.spree_roles << cs_role- user.spree_roles << merch_role- Spree.permissions.assign(:customer_service, customer_service_permission_set)- Spree.permissions.assign(:merchandiser, merchandiser_permission_set)- end-- it 'combines permission sets from all roles' do- ability = Spree::Ability.new(user)-- expect(ability.can?(:read, Spree::Order)).to be true- expect(ability.can?(:manage, Spree::Product)).to be true- end- end-- context 'user with unconfigured role' do- let(:role) { create(:role, name: 'unconfigured_role') }- let(:user) { create(:user) }-- before do- user.spree_roles << role- # Don't configure any permission sets for this role- end-- it 'grants no permissions when no sets are configured for the role' do- ability = Spree::Ability.new(user)-- expect(ability.can?(:read, Spree::Product)).to be false- expect(ability.can?(:create, Spree::Order)).to be false- expect(ability.can?(:manage, Spree::Product)).to be false- end- end- end-- describe 'default role' do- let(:guest_user) { Spree.customer_class.new }-- before do- Spree.permissions.assign(:default, Spree::PermissionSets::DefaultCustomer)- end-- it 'applies default permissions to non-persisted users' do- ability = Spree::Ability.new(guest_user)-- expect(ability.can?(:read, Spree::Product)).to be true- expect(ability.can?(:create, Spree::Order)).to be true- expect(ability.can?(:manage, Spree::Product)).to be false- end- end-- describe 'admin role' do- let(:admin_role) { Spree::Role.find_or_create_by!(name: 'admin') }- let(:admin_user) { create(:admin_user) }-- before do- admin_user.spree_roles << admin_role unless admin_user.spree_roles.include?(admin_role)- Spree.permissions.assign(:admin, Spree::PermissionSets::SuperUser)- end-- it 'applies super user permissions to admin users' do- ability = Spree::Ability.new(admin_user)-- expect(ability.can?(:manage, :all)).to be true- end- end-- describe 'permission configuration API' do- it 'allows configuring permissions like Solidus' do- Spree.permissions.assign(:customer_service, [- Spree::PermissionSets::OrderDisplay,- Spree::PermissionSets::UserDisplay- ])-- expect(Spree.permissions.permission_sets_for(:customer_service)).to include(- Spree::PermissionSets::OrderDisplay,- Spree::PermissionSets::UserDisplay- )- end-- it 'allows clearing permissions from a role' do- Spree.permissions.assign(:customer_service, Spree::PermissionSets::OrderDisplay)- Spree.permissions.clear(:customer_service)-- expect(Spree.permissions.permission_sets_for(:customer_service)).to be_empty- end- end-enddiff --git a/spree/core/spec/models/spree/permission_sets/base_spec.rb b/spree/core/spec/models/spree/permission_sets/base_spec.rbdeleted file mode 100644index c258e5d0dc..0000000000--- a/spree/core/spec/models/spree/permission_sets/base_spec.rb+++ /dev/null@@ -1,73 +0,0 @@-require 'spec_helper'-require 'cancan/matchers'--RSpec.describe Spree::PermissionSets::Base do- let(:user) { build(:user) }- let(:store) { @default_store }- let(:ability) { Spree::Ability.new(user, store: store) }-- describe '#initialize' do- subject(:permission_set) { described_class.new(ability) }-- it 'stores the ability' do- expect(permission_set.ability).to eq(ability)- end- end-- describe '#activate!' do- subject(:permission_set) { described_class.new(ability) }-- it 'raises NotImplementedError' do- expect { permission_set.activate! }.to raise_error(NotImplementedError, /must implement #activate!/)- end- end-- describe 'delegation methods' do- let(:permission_set_class) do- Class.new(described_class) do- def activate!- can :read, Spree::Order- cannot :destroy, Spree::Order- end-- def test_can?- can?(:read, Spree::Order)- end- end- end-- subject(:permission_set) { permission_set_class.new(ability) }-- before { permission_set.activate! }-- describe '#can' do- it 'delegates to ability' do- expect(ability.can?(:read, Spree::Order)).to be true- end- end-- describe '#cannot' do- it 'delegates to ability' do- expect(ability.can?(:destroy, Spree::Order)).to be false- end- end-- describe '#can?' do- it 'delegates to ability' do- expect(permission_set.test_can?).to be true- end- end-- describe '#user' do- it 'returns the user from the ability' do- expect(permission_set.send(:user)).to eq(user)- end- end-- describe '#store' do- it 'returns the store from the ability' do- expect(permission_set.send(:store)).to eq(store)- end- end- end-enddiff --git a/spree/core/spec/models/spree/permission_sets/default_customer_spec.rb b/spree/core/spec/models/spree/permission_sets/default_customer_spec.rbdeleted file mode 100644index 2f2cc5619b..0000000000--- a/spree/core/spec/models/spree/permission_sets/default_customer_spec.rb+++ /dev/null@@ -1,199 +0,0 @@-require 'spec_helper'-require 'cancan/matchers'--RSpec.describe Spree::PermissionSets::DefaultCustomer do- let(:user) { create(:user) }- let(:ability) { Spree::Ability.new(user) }-- subject(:permission_set) { described_class.new(ability) }-- before { permission_set.activate! }-- describe '#activate!' do- context 'catalog read access' do- it 'grants read access to Country' do- expect(ability.can?(:read, Spree::Country)).to be true- end-- it 'grants read access to Product' do- expect(ability.can?(:read, Spree::Product)).to be true- end-- it 'grants read access to Variant' do- expect(ability.can?(:read, Spree::Variant)).to be true- end-- it 'grants read access to Taxon' do- expect(ability.can?(:read, Spree::Category)).to be true- end-- it 'grants read access to Store' do- expect(ability.can?(:read, Spree::Store)).to be true- end- end-- context 'order permissions' do- it 'allows creating orders' do- expect(ability.can?(:create, Spree::Order)).to be true- end-- context 'with user order' do- let(:order) { build(:order, customer: user) }-- it 'allows viewing own order' do- expect(ability.can?(:show, order)).to be true- end-- it 'allows updating own incomplete order' do- allow(order).to receive(:completed?).and_return(false)- expect(ability.can?(:update, order)).to be true- end-- it 'prevents updating own completed order' do- allow(order).to receive(:completed?).and_return(true)- expect(ability.can?(:update, order)).to be false- end- end-- context 'with token' do- let(:order) { build(:order, customer: nil, token: 'secret') }-- it 'allows viewing order with correct token' do- expect(ability.can?(:show, order, 'secret')).to be true- end-- it 'allows updating incomplete order with correct token' do- allow(order).to receive(:completed?).and_return(false)- expect(ability.can?(:update, order, 'secret')).to be true- end-- it 'prevents viewing order with incorrect token' do- expect(ability.can?(:show, order, 'wrong')).to be false- end- end- end-- context 'user account permissions' do- it 'allows viewing own user' do- expect(ability.can?(:show, user)).to be true- end-- it 'allows updating own user' do- expect(ability.can?(:update, user)).to be true- end-- it 'allows destroying own user' do- expect(ability.can?(:destroy, user)).to be true- end-- it 'prevents viewing other user' do- other_user = create(:user)- expect(ability.can?(:show, other_user)).to be false- end-- it 'allows creating new user' do- expect(ability.can?(:create, Spree.customer_class)).to be true- end- end-- context 'with non-persisted user' do- let(:guest_user) { build(:user) }- let(:guest_ability) { Spree::Ability.new(guest_user) }- let(:guest_permission_set) { described_class.new(guest_ability) }-- before { guest_permission_set.activate! }-- it 'allows viewing self' do- expect(guest_ability.can?(:show, guest_user)).to be true- end-- it 'allows updating self' do- expect(guest_ability.can?(:update, guest_user)).to be true- end- end-- context 'address permissions' do- let(:own_address) { build(:address, user_id: user.id) }- let(:other_address) { build(:address, user_id: create(:user).id) }-- it 'allows managing own address' do- expect(ability.can?(:manage, own_address)).to be true- end-- it 'prevents managing other user address' do- expect(ability.can?(:manage, other_address)).to be false- end-- context 'with guest user (non-persisted)' do- let(:guest_user) { Spree.customer_class.new }- let(:guest_ability) { Spree::Ability.new(guest_user) }- let(:guest_permission_set) { described_class.new(guest_ability) }- let(:guest_address) { build(:address, user_id: nil) }- let(:other_guest_address) { create(:address, user_id: nil) }-- before { guest_permission_set.activate! }-- it 'prevents guest user from managing addresses with nil user_id (IDOR protection)' do- expect(guest_ability.can?(:manage, guest_address)).to be false- end-- it 'prevents guest user from editing other guest addresses (IDOR protection)' do- expect(guest_ability.can?(:edit, other_guest_address)).to be false- end-- it 'prevents guest user from updating other guest addresses (IDOR protection)' do- expect(guest_ability.can?(:update, other_guest_address)).to be false- end-- it 'prevents guest user from reading other guest addresses (IDOR protection)' do- expect(guest_ability.can?(:read, other_guest_address)).to be false- end- end- end-- context 'credit card permissions' do- let(:own_card) { build(:credit_card, user_id: user.id) }- let(:other_card) { build(:credit_card, user_id: create(:user).id) }-- it 'allows reading own credit card' do- expect(ability.can?(:read, own_card)).to be true- end-- it 'allows destroying own credit card' do- expect(ability.can?(:destroy, own_card)).to be true- end-- it 'prevents reading other user credit card' do- expect(ability.can?(:read, other_card)).to be false- end- end-- context 'wishlist permissions' do- let(:own_wishlist) { build(:wishlist, customer: user) }- let(:public_wishlist) { build(:wishlist, customer: create(:user), is_private: false) }- let(:private_wishlist) { build(:wishlist, customer: create(:user), is_private: true) }-- it 'allows managing own wishlist' do- expect(ability.can?(:manage, own_wishlist)).to be true- end-- it 'allows viewing public wishlist' do- expect(ability.can?(:show, public_wishlist)).to be true- end-- it 'prevents viewing private wishlist' do- expect(ability.can?(:show, private_wishlist)).to be false- end- end-- context 'admin permissions' do- it 'does not grant admin access' do- expect(ability.can?(:admin, :all)).to be false- end-- it 'does not grant manage access to Product' do- expect(ability.can?(:manage, Spree::Product)).to be false- end- end- end-enddiff --git a/spree/core/spec/models/spree/permission_sets/order_management_spec.rb b/spree/core/spec/models/spree/permission_sets/order_management_spec.rbdeleted file mode 100644index f911edabb4..0000000000--- a/spree/core/spec/models/spree/permission_sets/order_management_spec.rb+++ /dev/null@@ -1,85 +0,0 @@-require 'spec_helper'-require 'cancan/matchers'--RSpec.describe Spree::PermissionSets::OrderManagement do- let(:user) { build(:user) }- let(:ability) { Spree::Ability.new(user) }-- subject(:permission_set) { described_class.new(ability) }-- before { permission_set.activate! }-- describe '#activate!' do- it 'grants manage access to Order' do- expect(ability.can?(:manage, Spree::Order)).to be true- end-- it 'grants manage access to Payment' do- expect(ability.can?(:manage, Spree::Payment)).to be true- end-- it 'grants manage access to Shipment' do- expect(ability.can?(:manage, Spree::Shipment)).to be true- end-- it 'grants manage access to Adjustment' do- expect(ability.can?(:manage, Spree::Discount)).to be true- expect(ability.can?(:manage, Spree::Fee)).to be true- expect(ability.can?(:manage, Spree::TaxLine)).to be true- end-- it 'grants manage access to LineItem' do- expect(ability.can?(:manage, Spree::LineItem)).to be true- end-- it 'grants manage access to Return' do- expect(ability.can?(:manage, Spree::Return)).to be true- end-- it 'grants manage access to Exchange' do- expect(ability.can?(:manage, Spree::Exchange)).to be true- end-- it 'grants manage access to Claim' do- expect(ability.can?(:manage, Spree::Claim)).to be true- end-- it 'grants manage access to Refund' do- expect(ability.can?(:manage, Spree::Refund)).to be true- end-- it 'does not grant manage access to Product' do- expect(ability.can?(:manage, Spree::Product)).to be false- end-- context 'order restrictions' do- let(:cancelable_order) { build(:order) }- let(:non_cancelable_order) { build(:order) }- let(:deletable_order) { build(:order) }- let(:non_deletable_order) { build(:order) }-- before do- allow(cancelable_order).to receive(:allow_cancel?).and_return(true)- allow(non_cancelable_order).to receive(:allow_cancel?).and_return(false)- allow(deletable_order).to receive(:can_be_deleted?).and_return(true)- allow(non_deletable_order).to receive(:can_be_deleted?).and_return(false)- end-- it 'allows canceling orders that allow cancellation' do- expect(ability.can?(:cancel, cancelable_order)).to be true- end-- it 'prevents canceling orders that do not allow cancellation' do- expect(ability.can?(:cancel, non_cancelable_order)).to be false- end-- it 'allows destroying orders that can be deleted' do- expect(ability.can?(:destroy, deletable_order)).to be true- end-- it 'prevents destroying orders that cannot be deleted' do- expect(ability.can?(:destroy, non_deletable_order)).to be false- end- end- end-enddiff --git a/spree/core/spec/models/spree/permission_sets/product_management_spec.rb b/spree/core/spec/models/spree/permission_sets/product_management_spec.rbdeleted file mode 100644index c385041b06..0000000000--- a/spree/core/spec/models/spree/permission_sets/product_management_spec.rb+++ /dev/null@@ -1,53 +0,0 @@-require 'spec_helper'-require 'cancan/matchers'--RSpec.describe Spree::PermissionSets::ProductManagement do- let(:user) { build(:user) }- let(:ability) { Spree::Ability.new(user) }-- subject(:permission_set) { described_class.new(ability) }-- before { permission_set.activate! }-- describe '#activate!' do- it 'grants manage access to Product' do- expect(ability.can?(:manage, Spree::Product)).to be true- end-- it 'grants manage access to Variant' do- expect(ability.can?(:manage, Spree::Variant)).to be true- end-- it 'grants manage access to OptionType' do- expect(ability.can?(:manage, Spree::OptionType)).to be true- end-- it 'grants manage access to OptionValue' do- expect(ability.can?(:manage, Spree::OptionValue)).to be true- end-- it 'grants manage access to Taxon' do- expect(ability.can?(:manage, Spree::Category)).to be true- end-- it 'grants manage access to Classification' do- expect(ability.can?(:manage, Spree::ProductCategory)).to be true- end-- it 'grants manage access to Price' do- expect(ability.can?(:manage, Spree::Price)).to be true- end-- it 'grants manage access to ProductPublication' do- expect(ability.can?(:manage, Spree::ProductPublication)).to be true- end-- it 'does not grant manage access to Order' do- expect(ability.can?(:manage, Spree::Order)).to be false- end-- it 'does not grant manage access to User' do- expect(ability.can?(:manage, Spree.customer_class)).to be false- end- end-enddiff --git a/spree/core/spec/models/spree/permission_sets/super_user_spec.rb b/spree/core/spec/models/spree/permission_sets/super_user_spec.rbdeleted file mode 100644index 1f7a692292..0000000000--- a/spree/core/spec/models/spree/permission_sets/super_user_spec.rb+++ /dev/null@@ -1,76 +0,0 @@-require 'spec_helper'-require 'cancan/matchers'--RSpec.describe Spree::PermissionSets::SuperUser do- let(:user) { build(:user) }- let(:ability) { Spree::Ability.new(user) }-- subject(:permission_set) { described_class.new(ability) }-- before { permission_set.activate! }-- describe '#activate!' do- it 'grants manage access to all resources' do- expect(ability.can?(:manage, :all)).to be true- end-- it 'grants manage access to Order' do- expect(ability.can?(:manage, Spree::Order)).to be true- end-- it 'grants manage access to Product' do- expect(ability.can?(:manage, Spree::Product)).to be true- end-- context 'order restrictions' do- let(:cancelable_order) { build(:order) }- let(:non_cancelable_order) { build(:order) }- let(:deletable_order) { build(:order) }- let(:non_deletable_order) { build(:order) }-- before do- allow(cancelable_order).to receive(:allow_cancel?).and_return(true)- allow(non_cancelable_order).to receive(:allow_cancel?).and_return(false)- allow(deletable_order).to receive(:can_be_deleted?).and_return(true)- allow(non_deletable_order).to receive(:can_be_deleted?).and_return(false)- end-- it 'allows canceling orders that allow cancellation' do- expect(ability.can?(:cancel, cancelable_order)).to be true- end-- it 'prevents canceling orders that do not allow cancellation' do- expect(ability.can?(:cancel, non_cancelable_order)).to be false- end-- it 'allows destroying orders that can be deleted' do- expect(ability.can?(:destroy, deletable_order)).to be true- end-- it 'prevents destroying orders that cannot be deleted' do- expect(ability.can?(:destroy, non_deletable_order)).to be false- end- end-- context 'admin role protection' do- let(:admin_role) { build(:role, name: 'admin') }- let(:other_role) { build(:role, name: 'customer_service') }-- it 'prevents updating the admin role' do- expect(ability.can?(:update, admin_role)).to be false- end-- it 'prevents destroying the admin role' do- expect(ability.can?(:destroy, admin_role)).to be false- end-- it 'allows updating other roles' do- expect(ability.can?(:update, other_role)).to be true- end-- it 'allows destroying other roles' do- expect(ability.can?(:destroy, other_role)).to be true- end- end- end-enddiff --git a/spree/core/spec/models/spree/role_spec.rb b/spree/core/spec/models/spree/role_spec.rbindex fa550031e8..5fa66ec265 100644--- a/spree/core/spec/models/spree/role_spec.rb+++ b/spree/core/spec/models/spree/role_spec.rb@@ -15,10 +15,115 @@ describe Spree::Role doenddescribe '.default_admin_role' do- let(:admin_role) { create(:role, name: 'admin') }+ it 'returns the admin role, seeded immutable' do+ admin_role = Spree::Role.default_admin_role- it 'returns the default admin role' do- expect(Spree::Role.default_admin_role.name).to eq('admin')+ expect(admin_role.name).to eq('admin')+ expect(admin_role.read_attribute(:mutable)).to be false+ end+ end++ describe '#permissions' do+ it 'normalizes to a unique array of present strings' do+ role = build(:role, permissions: [:read_orders, 'read_orders', '', nil, 'write_products'])++ expect(role.permissions).to eq(%w[read_orders write_products])+ end++ it 'rejects unknown catalog keys' do+ role = build(:role, permissions: %w[read_orders write_bogus])++ expect(role).not_to be_valid+ expect(role.errors[:permissions].join).to include('write_bogus')+ end++ it 'rejects stored aliases' do+ expect(build(:role, permissions: %w[write_all])).not_to be_valid+ end+ end++ describe 'admin role protection' do+ let(:admin_role) { Spree::Role.default_admin_role }++ it 'is not mutable' do+ expect(admin_role.mutable?).to be false+ end++ it 'cannot be renamed' do+ admin_role.name = 'renamed'++ expect(admin_role).not_to be_valid+ expect(admin_role.errors[:name]).to be_present+ end++ it 'cannot change permissions' do+ admin_role.permissions = %w[read_orders]++ expect(admin_role).not_to be_valid+ end++ it 'cannot be destroyed' do+ expect(admin_role.destroy).to be false+ expect(admin_role.errors[:base]).to be_present+ end++ it 'stays protected by name even if the mutable flag is stale' do+ admin_role.update_column(:mutable, true)++ expect(admin_role.reload.mutable?).to be false+ expect(admin_role.destroy).to be false+ end+ end++ describe 'host-locked roles' do+ let(:locked_role) { create(:role, name: 'compliance', mutable: false, permissions: %w[read_orders]) }++ it 'cannot be renamed' do+ locked_role.name = 'renamed'++ expect(locked_role).not_to be_valid+ end++ it 'cannot change permissions' do+ locked_role.permissions = %w[write_orders]++ expect(locked_role).not_to be_valid+ end++ it 'cannot be destroyed' do+ expect(locked_role.destroy).to be false+ end+ end++ describe 'mutable roles' do+ it 'can be renamed and re-permissioned' do+ role = create(:role, name: 'support', permissions: %w[read_orders])++ expect(role.update(name: 'helpdesk', permissions: %w[read_orders read_customers])).to be true+ end+ end++ describe '#can_be_deleted?' do+ it 'is true for an unreferenced mutable role' do+ expect(create(:role, name: 'support').can_be_deleted?).to be true+ end++ it 'is false while staff hold the role' do+ user.spree_roles << role++ expect(role.can_be_deleted?).to be false+ expect(role.destroy).to be false+ end++ it 'is false while a pending invitation references the role' do+ role = create(:role, name: 'support')+ create(:invitation, role: role)++ expect(role.can_be_deleted?).to be false+ end++ it 'is false for the admin role' do+ expect(Spree::Role.default_admin_role.can_be_deleted?).to be falseendendenddiff --git a/spree/lib/generators/spree/install/templates/config/initializers/spree.rb b/spree/lib/generators/spree/install/templates/config/initializers/spree.rbindex 5984220d0b..3bb1a78330 100644--- a/spree/lib/generators/spree/install/templates/config/initializers/spree.rb+++ b/spree/lib/generators/spree/install/templates/config/initializers/spree.rb@@ -82,29 +82,19 @@ Rails.application.config.after_initialize do# Spree.reports << Spree::Reports::MassivelyOvercomplexReportForCfo# Role-based permissions- # Configure which permission sets are assigned to each role- # More on permission sets: https://spreecommerce.org/docs/developer/customization/permissions- Spree.permissions.assign(:default, [Spree::PermissionSets::DefaultCustomer])- Spree.permissions.assign(:admin, [Spree::PermissionSets::SuperUser])-- # Example: Create a custom role with specific permissions- # Spree.permissions.assign(:customer_service, [- # Spree::PermissionSets::DashboardDisplay,- # Spree::PermissionSets::OrderManagement,- # Spree::PermissionSets::UserDisplay- # ])+ # Staff roles and their permissions are managed as data — in the dashboard+ # (Settings → Roles), via the Admin API, or in db/seeds.rb:+ #+ # Spree::Role.find_or_create_by!(name: 'support')+ # .update!(permissions: %w[read_orders read_customers])+ #+ # Extensions can register additional permission resources:+ # Spree.permissions.register_resource(:reviews, group: :catalog, subjects: -> { [MyApp::Review] })+ #+ # For record-level custom rules, register a plain CanCan::Ability class:+ # Spree::Ability.register_ability(MyApp::RegionalSupportAbility)#- # Available permission sets:- # - Spree::PermissionSets::SuperUser (full admin access)- # - Spree::PermissionSets::DefaultCustomer (storefront access)- # - Spree::PermissionSets::DashboardDisplay (view admin dashboard)- # - Spree::PermissionSets::OrderDisplay / OrderManagement- # - Spree::PermissionSets::ProductDisplay / ProductManagement- # - Spree::PermissionSets::UserDisplay / UserManagement- # - Spree::PermissionSets::StockDisplay / StockManagement- # - Spree::PermissionSets::PromotionManagement- # - Spree::PermissionSets::ConfigurationManagement- # - Spree::PermissionSets::RoleManagement+ # More: https://spreecommerce.org/docs/developer/customization/permissionsend# Background job queue configuration