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
Documented ten admin actions that had no API reference (V-3779) (#15093)
Damian Legawiecfc3f80df1527
diff --git a/docs/api-reference/admin.yaml b/docs/api-reference/admin.yamlindex 2bfb4751fe..0af2bb6e33 100644--- a/docs/api-reference/admin.yaml+++ b/docs/api-reference/admin.yaml@@ -7701,6 +7701,93 @@ paths:schema:"$ref": "#/components/schemas/TaxIdentifierUpdateParams"required: true+ "/api/v3/admin/customers/{customer_id}/tax_identifiers/{id}/validate":+ parameters:+ - name: x-spree-api-key+ in: header+ required: true+ schema:+ type: string+ - name: Authorization+ in: header+ required: true+ schema:+ type: string+ - name: customer_id+ in: path+ required: true+ schema:+ type: string+ - name: id+ in: path+ required: true+ schema:+ type: string+ post:+ summary: Re-check a customer tax registration+ tags:+ - Customers+ 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 registration = await client.customers.taxIdentifiers.validate(+ 'cust_UkLWZg9DAJ',+ 'txi_UkLWZg9DAJ',+ )+ - lang: bash+ label: Spree CLI+ source: spree api post /customers/{customer_id}/tax_identifiers/{id}/validate+ -d '{ ... }'+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Asks the registry again. Manual because a registry answers only "valid now" — a number verified+ last year may have been deregistered since — and because a check that came back unavailable+ cannot otherwise be retried without editing the number.+++ **Required scope:** `write_customers` (for API-key authentication).+ responses:+ '202':+ description: registry check queued+ content:+ application/json:+ example:+ id: txi_UkLWZg9DAJ+ kind: eu_vat+ value: DE100000032+ validation_status: pending+ validation_evidence:+ source:+ validated_at:+ created_at: '2026-01-15T12:00:00.000Z'+ updated_at: '2026-01-15T12:00:00.000Z'+ validatable: true+ customer_id: cust_UkLWZg9DAJ+ cart_id:+ order_id:+ schema:+ "$ref": "#/components/schemas/TaxIdentifier"+ '422':+ description: no validator installed for this kind+ content:+ application/json:+ example:+ error:+ code: tax_id_not_validatable+ message: No registry validator is installed for tax identifier kind+ 'eu_vat'+ schema:+ "$ref": "#/components/schemas/ErrorResponse""/api/v3/admin/customers":get:summary: List customers@@ -15999,6 +16086,81 @@ paths:schema:"$ref": "#/components/schemas/ClaimUpdateParams"required: true+ "/api/v3/admin/orders/{order_id}/claims/{id}/approve":+ patch:+ summary: Approve a claim+ tags:+ - Orders+ 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 claim = await client.orders.claims.approve('or_UkLWZg9DAJ', 'claim_UkLWZg9DAJ')+ - lang: bash+ label: Spree CLI+ source: spree api patch /orders/{order_id}/claims/{id}/approve -d '{ ... }'+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Accepts an open claim, the step before resolving it with a refund, a replacement or both. Only an open claim can be approved; deny it to turn it down.++ **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+ - name: id+ in: path+ required: true+ description: Claim prefixed ID+ schema:+ type: string+ responses:+ '200':+ description: claim approved+ content:+ application/json:+ example:+ id: claim_UkLWZg9DAJ+ number: CLM1001+ status: approved+ resolution:+ order_id: or_UkLWZg9DAJ+ reason_id:+ refund_total: '10.00'+ approved_at: '2026-01-15T12:00:00Z'+ resolved_at:+ denied_at:+ canceled_at:+ memo: Arrived with a cracked screen+ metadata: {}+ created_at: '2026-01-15T12:00:00.000Z'+ updated_at: '2026-01-15T12:00:00.000Z'+ created_by_id: adm_UkLWZg9DAJ+ created_by_type: admin_user+ schema:+ "$ref": "#/components/schemas/Claim""/api/v3/admin/orders/{order_id}/claims/{id}/resolve":patch:summary: Resolve a claim@@ -16585,6 +16747,74 @@ paths:message: Digital link not foundschema:"$ref": "#/components/schemas/ErrorResponse"+ "/api/v3/admin/digital_links/{id}/reset":+ parameters:+ - name: id+ in: path+ required: true+ description: Digital link ID+ schema:+ type: string+ patch:+ summary: Reset a digital link+ tags:+ - Orders+ 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 digitalLink = await client.digitalLinks.reset('dl_xxx')+ - lang: bash+ label: Spree CLI+ source: spree api patch /digital_links/{id}/reset -d '{ ... }'+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Gives the customer their full download allowance back and restarts the+ link's expiry clock. Use it when a download failed, or the file was+ replaced after the customer had used up their attempts.+++ **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:+ '200':+ description: digital link reset+ content:+ application/json:+ example:+ id: dl_UkLWZg9DAJ+ access_counter: 0+ filename: thinking-cat.jpg+ content_type: image/jpeg+ download_url: "/api/v3/store/digital_links/tPqch4JvZidezkNn2YoqxDLc"+ expires_at: '2026-01-22T12:00:00Z'+ authorizable: true+ expired: false+ access_limit_exceeded: false+ created_at: '2026-01-15T12:00:00.000Z'+ updated_at: '2026-01-15T12:00:00.000Z'+ schema:+ "$ref": "#/components/schemas/DigitalLink""/api/v3/admin/exchanges":get:summary: List exchanges@@ -17074,18 +17304,11 @@ paths:schema:"$ref": "#/components/schemas/ExchangeUpdateParams"required: true- "/api/v3/admin/orders/{order_id}/exchanges/{id}/receive":+ "/api/v3/admin/orders/{order_id}/exchanges/{id}/approve":patch:- summary: Receive an exchange+ summary: Approve an exchangetags:- Orders- security:- - api_key: []- bearer_auth: []- description: |-- Records the goods that came back on an approved exchange. Omit `items` to receive everything as requested and resellable.-- **Required scope:** `write_orders` (for API-key authentication).x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -17097,13 +17320,18 @@ paths:secretKey: 'sk_xxx',})- // Omit `items` to receive everything as requested and resellable.- const exchange = await client.orders.exchanges.receive('or_UkLWZg9DAJ', 'exch_UkLWZg9DAJ', {- items: [{ exchange_line_item_id: 'eli_UkLWZg9DAJ', quantity: 1, resellable: false }],- })+ const exchange = await client.orders.exchanges.approve('or_UkLWZg9DAJ', 'exch_UkLWZg9DAJ')- lang: bashlabel: Spree CLI- source: spree api patch /orders/{order_id}/exchanges/{id}/receive -d '{"items":[{"exchange_line_item_id":"eli_UkLWZg9DAJ","quantity":1,"resellable":false}]}'+ source: spree api patch /orders/{order_id}/exchanges/{id}/approve -d '{ ...+ }'+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Accepts a requested exchange so the customer can send the goods back for their replacement. Only a requested exchange can be approved; receive it once the goods arrive.++ **Required scope:** `write_orders` (for API-key authentication).parameters:- name: x-spree-api-keyin: header@@ -17129,18 +17357,18 @@ paths:type: stringresponses:'200':- description: exchange received+ description: exchange approvedcontent:application/json:example:id: exch_UkLWZg9DAJnumber: EX1001- status: received+ status: approvedorder_id: or_UkLWZg9DAJreason_id:price_difference: '9.99'approved_at: '2026-01-15T12:00:00Z'- received_at: '2026-01-15T12:00:00Z'+ received_at:fulfilled_at:canceled_at:memo: Wrong size@@ -17148,27 +17376,32 @@ paths:created_at: '2026-01-15T12:00:00.000Z'updated_at: '2026-01-15T12:00:00.000Z'stock_location_id: sloc_UkLWZg9DAJ- created_by_id:- created_by_type:+ created_by_id: adm_UkLWZg9DAJ+ created_by_type: admin_userschema:"$ref": "#/components/schemas/Exchange"- requestBody:- content:- application/json:- schema:- "$ref": "#/components/schemas/ExchangeReceiveParams"- "/api/v3/admin/orders/{order_id}/exchanges/{id}/fulfill":+ '422':+ description: the exchange is not requested+ content:+ application/json:+ example:+ error:+ code: processing_error+ message: Not requested+ schema:+ "$ref": "#/components/schemas/ErrorResponse"+ "/api/v3/admin/orders/{order_id}/exchanges/{id}/receive":patch:- summary: Fulfill an exchange+ summary: Receive an exchangetags:- Orderssecurity:- api_key: []bearer_auth: []description: |-- Ships the replacements for a received exchange and settles any price difference.+ Records the goods that came back on an approved exchange. Omit `items` to receive everything as requested and resellable.- **Required scope:** `write_orders` and `write_refunds` (for API-key authentication).+ **Required scope:** `write_orders` (for API-key authentication).x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -17180,12 +17413,95 @@ paths:secretKey: 'sk_xxx',})- const exchange = await client.orders.exchanges.fulfill('or_UkLWZg9DAJ', 'exch_UkLWZg9DAJ', {- refund_method: 'store_credit',+ // Omit `items` to receive everything as requested and resellable.+ const exchange = await client.orders.exchanges.receive('or_UkLWZg9DAJ', 'exch_UkLWZg9DAJ', {+ items: [{ exchange_line_item_id: 'eli_UkLWZg9DAJ', quantity: 1, resellable: false }],})- lang: bashlabel: Spree CLI- source: spree api patch /orders/{order_id}/exchanges/{id}/fulfill -d '{"refund_method":"store_credit"}'+ source: spree api patch /orders/{order_id}/exchanges/{id}/receive -d '{"items":[{"exchange_line_item_id":"eli_UkLWZg9DAJ","quantity":1,"resellable":false}]}'+ 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+ - name: id+ in: path+ required: true+ description: Exchange prefixed ID+ schema:+ type: string+ responses:+ '200':+ description: exchange received+ content:+ application/json:+ example:+ id: exch_UkLWZg9DAJ+ number: EX1001+ status: received+ order_id: or_UkLWZg9DAJ+ reason_id:+ price_difference: '9.99'+ approved_at: '2026-01-15T12:00:00Z'+ received_at: '2026-01-15T12:00:00Z'+ fulfilled_at:+ canceled_at:+ memo: Wrong size+ metadata: {}+ created_at: '2026-01-15T12:00:00.000Z'+ updated_at: '2026-01-15T12:00:00.000Z'+ stock_location_id: sloc_UkLWZg9DAJ+ created_by_id:+ created_by_type:+ schema:+ "$ref": "#/components/schemas/Exchange"+ requestBody:+ content:+ application/json:+ schema:+ "$ref": "#/components/schemas/ExchangeReceiveParams"+ "/api/v3/admin/orders/{order_id}/exchanges/{id}/fulfill":+ patch:+ summary: Fulfill an exchange+ tags:+ - Orders+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Ships the replacements for a received exchange and settles any price difference.++ **Required scope:** `write_orders` and `write_refunds` (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 exchange = await client.orders.exchanges.fulfill('or_UkLWZg9DAJ', 'exch_UkLWZg9DAJ', {+ refund_method: 'store_credit',+ })+ - lang: bash+ label: Spree CLI+ source: spree api patch /orders/{order_id}/exchanges/{id}/fulfill -d '{"refund_method":"store_credit"}'parameters:- name: x-spree-api-keyin: header@@ -20688,6 +21004,147 @@ paths:cancel_reason_name:customer_id: cust_UkLWZg9DAJfreight_summary:+ "/api/v3/admin/orders/{id}/resend_digital_links":+ post:+ summary: Resend digital download links+ tags:+ - Orders+ 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.orders.resendDigitalLinks('or_UkLWZg9DAJ')+ - lang: bash+ label: Spree CLI+ source: spree api post /orders/{id}/resend_digital_links -d '{ ... }'+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Emails the customer their download links for the digital products on+ this order again. Nothing is sent when the order has no digital links or+ the store does not send transactional emails. Use it when the original+ email was lost; to restore used-up downloads or an expired link, reset+ the digital link instead.+++ **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: digital links resent+ content:+ application/json:+ example:+ id: or_UkLWZg9DAJ+ market_id: mkt_UkLWZg9DAJ+ withdrawal_period_ends_at:+ within_withdrawal_period: true+ shipping_eq_billing_address: false+ cart_id:+ channel_id: ch_UkLWZg9DAJ+ company_id:+ company_name:+ po_document_filename:+ po_document_byte_size:+ number: R1001+ email: [email protected]+ customer_note:+ po_number:+ currency: USD+ locale: en+ total_quantity: 1+ coupon_code:+ fulfillment_status:+ payment_status:+ completed_at: '2026-01-15T12:00:00.000Z'+ item_total: '10.00'+ discount_total: '0.00'+ tax_total: '0.00'+ included_tax_total: '0.00'+ additional_tax_total: '0.00'+ delivery_total: '100.00'+ fee_total: '0.00'+ gift_card_total: '0.00'+ store_credit_total: '0.00'+ total: '110.00'+ amount_due: '110.00'+ covered_by_store_credit: false+ adjustment_total: '0.00'+ gift_card:+ market:+ id: mkt_UkLWZg9DAJ+ name: United States+ currency: USD+ default_locale: en+ tax_inclusive: false+ default: true+ country_codes:+ - US+ supported_locales:+ - en+ created_at: '2026-11-03T16:44:09.130Z'+ updated_at: '2026-11-03T16:44:09.130Z'+ tax_provider:+ external_references: {}+ status: placed+ last_ip_address:+ considered_risky: false+ confirmation_delivered: false+ store_owner_notification_delivered:+ metadata: {}+ cancel_note:+ canceled_at:+ approved_at:+ created_at: '2026-01-15T12:00:00.000Z'+ updated_at: '2026-01-15T12:00:00.000Z'+ payment_total: '0.00'+ commission_amount_total: '0.00'+ commission_tax_total: '0.00'+ commission_total: '0.00'+ preferred_stock_location_id:+ po_document_url:+ seller_id:+ order_group_id:+ tags: []+ internal_note:+ internal_note_html:+ approver_id:+ approver_type:+ canceler_id:+ canceler_type:+ created_by_id:+ created_by_type:+ cancel_reason_id:+ cancel_reason_name:+ customer_id: cust_UkLWZg9DAJ+ freight_summary:+ schema:+ "$ref": "#/components/schemas/Order""/api/v3/admin/returns":get:summary: List returns@@ -21213,18 +21670,11 @@ paths:schema:"$ref": "#/components/schemas/ReturnUpdateParams"required: true- "/api/v3/admin/orders/{order_id}/returns/{id}/receive":+ "/api/v3/admin/orders/{order_id}/returns/{id}/approve":patch:- summary: Receive a return+ summary: Approve a returntags:- Orders- security:- - api_key: []- bearer_auth: []- description: |-- Records what arrived on an approved return. Omit `items` to receive everything as requested and resellable; send rows for a partial or damaged receipt.-- **Required scope:** `write_orders` (for API-key authentication).x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -21236,13 +21686,18 @@ paths:secretKey: 'sk_xxx',})- // Omit `items` to receive everything as requested and resellable.- const orderReturn = await client.orders.returns.receive('or_UkLWZg9DAJ', 'ret_UkLWZg9DAJ', {- items: [{ return_line_item_id: 'rli_UkLWZg9DAJ', quantity: 1, resellable: false }],- })+ const orderReturn = await client.orders.returns.approve('or_UkLWZg9DAJ', 'ret_UkLWZg9DAJ')- lang: bashlabel: Spree CLI- source: spree api patch /orders/{order_id}/returns/{id}/receive -d '{"items":[{"return_line_item_id":"rli_UkLWZg9DAJ","quantity":1,"resellable":false}]}'+ source: spree api patch /orders/{order_id}/returns/{id}/approve -d '{ ...+ }'+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Accepts a requested return so the customer can send the goods back. Only a requested return can be approved; receive it once the goods arrive.++ **Required scope:** `write_orders` (for API-key authentication).parameters:- name: x-spree-api-keyin: header@@ -21268,19 +21723,19 @@ paths:type: stringresponses:'200':- description: return received+ description: return approvedcontent:application/json:example:id: ret_UkLWZg9DAJnumber: RET1001- status: received+ status: approvedorder_id: or_UkLWZg9DAJreason_id:refund_total: '10.00'refund_tax_total: '0.00'approved_at: '2026-01-15T12:00:00Z'- received_at: '2026-01-15T12:00:00Z'+ received_at:refunded_at:canceled_at:external_references: {}@@ -21289,8 +21744,8 @@ paths:created_at: '2026-01-15T12:00:00.000Z'updated_at: '2026-01-15T12:00:00.000Z'stock_location_id: sloc_UkLWZg9DAJ- created_by_id:- created_by_type:+ created_by_id: adm_UkLWZg9DAJ+ created_by_type: admin_userrefunded_total: '0.00'refundable_total: '10.00'documents: []@@ -21298,23 +21753,28 @@ paths:deliveries: []schema:"$ref": "#/components/schemas/Return"- requestBody:- content:- application/json:- schema:- "$ref": "#/components/schemas/ReturnReceiveParams"- "/api/v3/admin/orders/{order_id}/returns/{id}/refund":+ '422':+ description: the return is not requested+ content:+ application/json:+ example:+ error:+ code: processing_error+ message: Not requested+ schema:+ "$ref": "#/components/schemas/ErrorResponse"+ "/api/v3/admin/orders/{order_id}/returns/{id}/receive":patch:- summary: Refund a return+ summary: Receive a returntags:- Orderssecurity:- api_key: []bearer_auth: []description: |-- Pays the customer back for a received return, to store credit or through the original payment.+ Records what arrived on an approved return. Omit `items` to receive everything as requested and resellable; send rows for a partial or damaged receipt.- **Required scope:** `write_orders` and `write_refunds` (for API-key authentication).+ **Required scope:** `write_orders` (for API-key authentication).x-codeSamples:- lang: javascriptlabel: Spree Admin SDK@@ -21326,13 +21786,103 @@ paths:secretKey: 'sk_xxx',})- const orderReturn = await client.orders.returns.refund('or_UkLWZg9DAJ', 'ret_UkLWZg9DAJ', {- amount: '29.99',- refund_method: 'original_payment',+ // Omit `items` to receive everything as requested and resellable.+ const orderReturn = await client.orders.returns.receive('or_UkLWZg9DAJ', 'ret_UkLWZg9DAJ', {+ items: [{ return_line_item_id: 'rli_UkLWZg9DAJ', quantity: 1, resellable: false }],})- lang: bashlabel: Spree CLI- source: spree api patch /orders/{order_id}/returns/{id}/refund -d '{"amount":"29.99","refund_method":"original_payment"}'+ source: spree api patch /orders/{order_id}/returns/{id}/receive -d '{"items":[{"return_line_item_id":"rli_UkLWZg9DAJ","quantity":1,"resellable":false}]}'+ 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+ - name: id+ in: path+ required: true+ description: Return prefixed ID+ schema:+ type: string+ responses:+ '200':+ description: return received+ content:+ application/json:+ example:+ id: ret_UkLWZg9DAJ+ number: RET1001+ status: received+ order_id: or_UkLWZg9DAJ+ reason_id:+ refund_total: '10.00'+ refund_tax_total: '0.00'+ approved_at: '2026-01-15T12:00:00Z'+ received_at: '2026-01-15T12:00:00Z'+ refunded_at:+ canceled_at:+ external_references: {}+ memo: Item did not fit+ metadata: {}+ created_at: '2026-01-15T12:00:00.000Z'+ updated_at: '2026-01-15T12:00:00.000Z'+ stock_location_id: sloc_UkLWZg9DAJ+ created_by_id:+ created_by_type:+ refunded_total: '0.00'+ refundable_total: '10.00'+ documents: []+ labels: []+ deliveries: []+ schema:+ "$ref": "#/components/schemas/Return"+ requestBody:+ content:+ application/json:+ schema:+ "$ref": "#/components/schemas/ReturnReceiveParams"+ "/api/v3/admin/orders/{order_id}/returns/{id}/refund":+ patch:+ summary: Refund a return+ tags:+ - Orders+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Pays the customer back for a received return, to store credit or through the original payment.++ **Required scope:** `write_orders` and `write_refunds` (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 orderReturn = await client.orders.returns.refund('or_UkLWZg9DAJ', 'ret_UkLWZg9DAJ', {+ amount: '29.99',+ refund_method: 'original_payment',+ })+ - lang: bash+ label: Spree CLI+ source: spree api patch /orders/{order_id}/returns/{id}/refund -d '{"amount":"29.99","refund_method":"original_payment"}'parameters:- name: x-spree-api-keyin: header@@ -21633,6 +22183,106 @@ paths:required:- data- meta+ "/api/v3/admin/orders/{order_id}/returns/{return_id}/labels/{id}/refund":+ patch:+ summary: Refund a return label+ tags:+ - Orders+ 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 label = await client.orders.returns.labels.refund(+ 'or_UkLWZg9DAJ',+ 'ret_UkLWZg9DAJ',+ 'lbl_UkLWZg9DAJ',+ )+ - lang: bash+ label: Spree CLI+ source: spree api patch /orders/{order_id}/returns/{return_id}/labels/{id}/refund+ -d '{ ... }'+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Asks the carrier to refund a purchased return label the customer never used, such as when the return is canceled. An uploaded label has nothing to refund.++ **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+ - name: return_id+ in: path+ required: true+ description: Return prefixed ID+ schema:+ type: string+ - name: id+ in: path+ required: true+ description: Shipping label prefixed ID+ schema:+ type: string+ responses:+ '200':+ description: refund filed+ content:+ application/json:+ example:+ id: lbl_UkLWZg9DAJ+ source: purchased+ status: refunded+ carrier: ups+ carrier_name: UPS+ service: Ground+ tracking_number: 1Z879E930346830007+ currency: USD+ format: pdf+ external_id: shp_4+ metadata: {}+ refunded_at: '2026-01-15T12:00:00.000Z'+ created_at: '2026-01-15T12:00:00.000Z'+ updated_at: '2026-01-15T12:00:00.000Z'+ owner_id: ret_UkLWZg9DAJ+ owner_type: return+ cost: '7.25'+ integration_id:+ file_pending: false+ download_url:+ schema:+ "$ref": "#/components/schemas/ShippingLabel"+ '422':+ description: uploaded labels cannot be refunded+ content:+ application/json:+ example:+ error:+ code: processing_error+ message: An uploaded label was not bought through Spree and cannot+ be refunded — delete it instead+ schema:+ "$ref": "#/components/schemas/ErrorResponse""/api/v3/admin/payment_methods/{payment_method_id}/custom_fields":get:summary: List payment method custom fields@@ -25560,6 +26210,119 @@ paths:specific: falseschema:"$ref": "#/components/schemas/ErrorResponse"+ "/api/v3/admin/products/{id}/clone":+ parameters:+ - name: id+ in: path+ required: true+ description: Product ID+ schema:+ type: string+ post:+ summary: Clone a product+ tags:+ - Products+ 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 copy = await client.products.clone('prod_UkLWZg9DAJ')+ - lang: bash+ label: Spree CLI+ source: spree api post /products/{id}/clone -d '{ ... }'+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Creates a draft copy of a product, named "COPY OF …", with its variants,+ prices, stock locations, images, categories, channels and tags; stock on+ hand starts at zero. Use it to start a similar product from an existing+ one instead of building it from scratch.+++ **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: product cloned+ content:+ application/json:+ example:+ id: prod_gbHJdmfrXB+ name: COPY OF Product 1462357+ slug: copy-of-product-1462357+ meta_title:+ meta_description:+ meta_keywords:+ variant_count: 1+ available_on:+ preorder_ships_at:+ purchasable: true+ preorder: false+ in_stock: false+ backorderable: true+ available: false+ description: Dolore facere hic laboriosam sapiente nobis. Doloribus+ deleniti quasi esse aliquid voluptatem. Rem voluptate omnis suscipit+ adipisci laudantium. Deleniti error dolorum ratione dolor assumenda+ iusto. Laborum non rem sapiente temporibus quam inventore. Voluptatum+ magnam hic molestias laudantium necessitatibus. Totam ducimus provident+ aliquam repellendus nam maxime error natus. Ex aspernatur nostrum+ deserunt maxime quis occaecati expedita dolore. Debitis est laboriosam+ modi aspernatur cumque. Sapiente ab corrupti quos doloremque eius.+ Laborum officiis culpa voluptate fuga sed. Nemo possimus vel architecto+ quo modi. Velit aut non iusto exercitationem nostrum nemo. Velit+ illo nisi quaerat perspiciatis facilis temporibus quae esse.+ description_html: |-+ Dolore facere hic laboriosam sapiente nobis. Doloribus deleniti quasi esse aliquid voluptatem. Rem voluptate omnis suscipit adipisci laudantium.+ Deleniti error dolorum ratione dolor assumenda iusto. Laborum non rem sapiente temporibus quam inventore. Voluptatum magnam hic molestias laudantium necessitatibus. Totam ducimus provident aliquam repellendus nam maxime error natus.+ Ex aspernatur nostrum deserunt maxime quis occaecati expedita dolore. Debitis est laboriosam modi aspernatur cumque. Sapiente ab corrupti quos doloremque eius.+ Laborum officiis culpa voluptate fuga sed. Nemo possimus vel architecto quo modi. Velit aut non iusto exercitationem nostrum nemo. Velit illo nisi quaerat perspiciatis facilis temporibus quae esse.+ default_variant_id: variant_gbHJdmfrXB+ buy_box_variant_id: variant_gbHJdmfrXB+ thumbnail_url:+ tags: []+ price:+ id: price_gbHJdmfrXB+ currency: USD+ amount: '19.99'+ compare_at_amount:+ price_list_id:+ min_quantity: 1+ variant_id: variant_gbHJdmfrXB+ created_at: '2026-01-15T12:00:00.000Z'+ updated_at: '2026-01-15T12:00:00.000Z'+ original_price:+ seller_id:+ external_references: {}+ status: draft+ metadata: {}+ deleted_at:+ created_at: '2026-01-15T12:00:00.000Z'+ updated_at: '2026-01-15T12:00:00.000Z'+ delivery_profile_id: fp_UkLWZg9DAJ+ seller_name:+ product_type_id:+ tax_category_id: taxcat_UkLWZg9DAJ+ schema:+ "$ref": "#/components/schemas/Product""/api/v3/admin/products/bulk_status_update":post:summary: Bulk-update product status@@ -39670,6 +40433,77 @@ paths:schema:"$ref": "#/components/schemas/CatalogAssignParams"required: true+ "/api/v3/admin/catalogs/{id}/import_products":+ parameters:+ - name: id+ in: path+ required: true+ schema:+ type: string+ post:+ summary: Import price list products into a catalog+ tags:+ - Catalogs+ 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 { added_count } = await client.catalogs.importProducts('cat_86Rf07xd4z')+ - lang: bash+ label: Spree CLI+ source: spree api post /catalogs/{id}/import_products -d '{ ... }'+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Adds every product on the catalog's price list to its assortment. Products+ already in it stay, even ones the list does not price. Refused for a+ catalog without a price list; the count reports what was added.+++ **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 imported+ content:+ application/json:+ example:+ added_count: 1+ schema:+ type: object+ properties:+ added_count:+ type: integer+ required:+ - added_count+ '422':+ description: the catalog has no price list+ content:+ application/json:+ example:+ error:+ code: validation_error+ message: This catalog has no price list to import products from.+ schema:+ "$ref": "#/components/schemas/ErrorResponse""/api/v3/admin/catalogs/{catalog_id}/products":get:summary: List catalog products@@ -54339,6 +55173,93 @@ paths:schema:"$ref": "#/components/schemas/SellerInviteParams"required: true+ "/api/v3/admin/sellers/{seller_id}/invitations/{id}/resend":+ parameters:+ - name: seller_id+ in: path+ required: true+ description: Seller prefixed ID+ schema:+ type: string+ - name: id+ in: path+ required: true+ description: Invitation prefixed ID+ schema:+ type: string+ patch:+ summary: Resend a seller invitation+ tags:+ - Sellers+ 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 invitation = await client.sellers.invitations.resend('seller_UkLWZg9DAJ', 'inv_UkLWZg9DAJ')+ - lang: bash+ label: Spree CLI+ source: spree api patch /sellers/{seller_id}/invitations/{id}/resend -d '{+ ... }'+ security:+ - api_key: []+ bearer_auth: []+ description: |-+ Sends a pending invitation to the seller's team again, with a fresh+ acceptance link. Use it when the email never arrived; an invitation that+ has expired is refused, so invite the person again instead.+++ **Required scope:** `write_sellers` (for API-key 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: invitation resent+ content:+ application/json:+ example:+ id: inv_UkLWZg9DAJ+ email: [email protected]+ status: pending+ created_at: '2026-01-15T12:00:00.000Z'+ updated_at: '2026-01-15T12:00:00.000Z'+ expires_at: '2026-01-29T12:00:00.000Z'+ role_id: role_UkLWZg9DAJ+ role_name: admin+ inviter_email: [email protected]+ invitee_exists: false+ store:+ id: store_UkLWZg9DAJ+ name: Spree Test Store+ schema:+ "$ref": "#/components/schemas/Invitation"+ '422':+ description: the invitation has expired+ content:+ application/json:+ example:+ error:+ code: processing_error+ message: This invitation has expired. Invite them again to send+ a new one.+ schema:+ "$ref": "#/components/schemas/ErrorResponse""/api/v3/admin/sellers/{id}/approve":parameters:- name: iddiff --git a/packages/admin-sdk/examples/catalogs/import-products.ts b/packages/admin-sdk/examples/catalogs/import-products.tsnew file mode 100644index 0000000000..a2e02317da--- /dev/null+++ b/packages/admin-sdk/examples/catalogs/import-products.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 { added_count } = await client.catalogs.importProducts('cat_86Rf07xd4z')++// endregion:example++export { added_count }diff --git a/packages/admin-sdk/examples/customer-tax-identifiers/validate.ts b/packages/admin-sdk/examples/customer-tax-identifiers/validate.tsnew file mode 100644index 0000000000..1b1d534650--- /dev/null+++ b/packages/admin-sdk/examples/customer-tax-identifiers/validate.ts@@ -0,0 +1,16 @@+import { createAdminClient } from '@spree/admin-sdk'++const client = createAdminClient({+ baseUrl: 'https://your-store.com',+ secretKey: 'sk_xxx',+})++// region:example+const registration = await client.customers.taxIdentifiers.validate(+ 'cust_UkLWZg9DAJ',+ 'txi_UkLWZg9DAJ',+)++// endregion:example++export { registration }diff --git a/packages/admin-sdk/examples/digital-links/reset.ts b/packages/admin-sdk/examples/digital-links/reset.tsnew file mode 100644index 0000000000..ba9ba5cd67--- /dev/null+++ b/packages/admin-sdk/examples/digital-links/reset.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 digitalLink = await client.digitalLinks.reset('dl_xxx')++// endregion:example++export { digitalLink }diff --git a/packages/admin-sdk/examples/order-claims/approve.ts b/packages/admin-sdk/examples/order-claims/approve.tsnew file mode 100644index 0000000000..52917ed1f4--- /dev/null+++ b/packages/admin-sdk/examples/order-claims/approve.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 claim = await client.orders.claims.approve('or_UkLWZg9DAJ', 'claim_UkLWZg9DAJ')++// endregion:example++export { claim }diff --git a/packages/admin-sdk/examples/order-exchanges/approve.ts b/packages/admin-sdk/examples/order-exchanges/approve.tsnew file mode 100644index 0000000000..39f8d3a079--- /dev/null+++ b/packages/admin-sdk/examples/order-exchanges/approve.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 exchange = await client.orders.exchanges.approve('or_UkLWZg9DAJ', 'exch_UkLWZg9DAJ')++// endregion:example++export { exchange }diff --git a/packages/admin-sdk/examples/order-returns/approve.ts b/packages/admin-sdk/examples/order-returns/approve.tsnew file mode 100644index 0000000000..05fb2d28d2--- /dev/null+++ b/packages/admin-sdk/examples/order-returns/approve.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 orderReturn = await client.orders.returns.approve('or_UkLWZg9DAJ', 'ret_UkLWZg9DAJ')++// endregion:example++export { orderReturn }diff --git a/packages/admin-sdk/examples/order-returns/labels-refund.ts b/packages/admin-sdk/examples/order-returns/labels-refund.tsnew file mode 100644index 0000000000..70092c128e--- /dev/null+++ b/packages/admin-sdk/examples/order-returns/labels-refund.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 label = await client.orders.returns.labels.refund(+ 'or_UkLWZg9DAJ',+ 'ret_UkLWZg9DAJ',+ 'lbl_UkLWZg9DAJ',+)++// endregion:example++export { label }diff --git a/packages/admin-sdk/examples/orders/resend-digital-links.ts b/packages/admin-sdk/examples/orders/resend-digital-links.tsnew file mode 100644index 0000000000..9a04e2f1ba--- /dev/null+++ b/packages/admin-sdk/examples/orders/resend-digital-links.ts@@ -0,0 +1,11 @@+import { createAdminClient } from '@spree/admin-sdk'++const client = createAdminClient({+ baseUrl: 'https://your-store.com',+ secretKey: 'sk_xxx',+})++// region:example+await client.orders.resendDigitalLinks('or_UkLWZg9DAJ')++// endregion:examplediff --git a/packages/admin-sdk/examples/products/clone.ts b/packages/admin-sdk/examples/products/clone.tsnew file mode 100644index 0000000000..278f6b9eb7--- /dev/null+++ b/packages/admin-sdk/examples/products/clone.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 copy = await client.products.clone('prod_UkLWZg9DAJ')++// endregion:example++export { copy }diff --git a/packages/admin-sdk/examples/sellers/invitations-resend.ts b/packages/admin-sdk/examples/sellers/invitations-resend.tsnew file mode 100644index 0000000000..c094d947d6--- /dev/null+++ b/packages/admin-sdk/examples/sellers/invitations-resend.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 invitation = await client.sellers.invitations.resend('seller_UkLWZg9DAJ', 'inv_UkLWZg9DAJ')++// endregion:example++export { invitation }diff --git a/spree/api/spec/integration/spree/api/v3/admin/catalogs_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/catalogs_spec.rbindex 105a4878ed..6fe9f1eeb7 100644--- a/spree/api/spec/integration/spree/api/v3/admin/catalogs_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/catalogs_spec.rb@@ -125,6 +125,55 @@ RSpec.describe 'Admin Catalogs API', type: :request, swagger_doc: 'api-referenceendendend++ path '/api/v3/admin/catalogs/{id}/import_products' do+ parameter name: :id, in: :path, type: :string, required: true++ post 'Import price list products into a catalog' do+ tags 'Catalogs'+ admin_sdk_example 'catalogs/import-products'+ produces 'application/json'+ security [api_key: [], bearer_auth: []]+ description <<~DESC+ Adds every product on the catalog's price list to its assortment. Products+ already in it stay, even ones the list does not price. Refused for a+ catalog without a price list; the count reports what was added.+ DESC+ admin_scope :write, :products++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true++ response '200', 'products imported' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }+ let(:id) { catalog.prefixed_id }+ let!(:product) { create(:product, store: store) }++ before do+ price_list = create(:price_list, store: store).tap { |list| list.add_products([product.id]) }+ catalog.update!(price_list: price_list)+ end++ schema type: :object,+ properties: { added_count: { type: :integer } },+ required: %w[added_count]++ run_test! do |response|+ expect(JSON.parse(response.body)['added_count']).to eq(1)+ end+ end++ response '422', 'the catalog has no price list' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }+ let(:id) { catalog.prefixed_id }++ schema '$ref' => '#/components/schemas/ErrorResponse'++ run_test!+ end+ end+ end+path '/api/v3/admin/catalogs/{catalog_id}/products' doget 'List catalog products' dotags 'Catalogs'diff --git a/spree/api/spec/integration/spree/api/v3/admin/claims_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/claims_spec.rbindex 2d562de7d1..664ee6fec4 100644--- a/spree/api/spec/integration/spree/api/v3/admin/claims_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/claims_spec.rb@@ -132,6 +132,32 @@ RSpec.describe 'Admin Claims API', type: :request, swagger_doc: 'api-reference/aendend+ path '/api/v3/admin/orders/{order_id}/claims/{id}/approve' do+ patch 'Approve a claim' do+ tags 'Orders'+ admin_sdk_example 'order-claims/approve'+ produces 'application/json'+ security [api_key: [], bearer_auth: []]+ description 'Accepts an open claim, the step before resolving it with a refund, a replacement or both. Only an open claim can be approved; deny it to turn it down.'+ admin_scope :write, :orders++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true+ parameter name: :order_id, in: :path, type: :string, required: true, description: 'Order prefixed ID'+ parameter name: :id, in: :path, type: :string, required: true, description: 'Claim prefixed ID'++ response '200', 'claim approved' do+ let(:id) { record.prefixed_id }++ schema '$ref' => '#/components/schemas/Claim'++ run_test! do |response|+ expect(JSON.parse(response.body)['status']).to eq('approved')+ end+ end+ end+ end+path '/api/v3/admin/orders/{order_id}/claims/{id}/resolve' dopatch 'Resolve a claim' dotags 'Orders'diff --git a/spree/api/spec/integration/spree/api/v3/admin/customers/tax_identifiers_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/customers/tax_identifiers_spec.rbindex d9d27247fe..90d70665f9 100644--- a/spree/api/spec/integration/spree/api/v3/admin/customers/tax_identifiers_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/customers/tax_identifiers_spec.rb@@ -72,4 +72,50 @@ RSpec.describe 'Admin Customer Tax Identifiers API', type: :request, swagger_docendendend++ path '/api/v3/admin/customers/{customer_id}/tax_identifiers/{id}/validate' do+ let(:customer_id) { customer.prefixed_id }+ let(:id) { tax_identifier.prefixed_id }+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true+ parameter name: :customer_id, in: :path, type: :string, required: true+ parameter name: :id, in: :path, type: :string, required: true++ post 'Re-check a customer tax registration' do+ tags 'Customers'+ admin_sdk_example 'customer-tax-identifiers/validate'+ produces 'application/json'+ security [api_key: [], bearer_auth: []]+ description <<~DESC+ Asks the registry again. Manual because a registry answers only "valid now" — a number verified+ last year may have been deregistered since — and because a check that came back unavailable+ cannot otherwise be retried without editing the number.+ DESC+ admin_scope :write, :customers++ response '202', 'registry check queued' do+ # Core ships no registry for eu_vat, so the spec installs the base+ # validator; the queued job is not performed here.+ around do |example|+ with_tax_identifier_validator('eu_vat', 'Spree::TaxIdentifiers::Validator::Base') { example.run }+ end++ schema '$ref' => '#/components/schemas/TaxIdentifier'++ run_test! do |response|+ expect(JSON.parse(response.body)['validation_status']).to eq('pending')+ end+ end++ response '422', 'no validator installed for this kind' do+ schema '$ref' => '#/components/schemas/ErrorResponse'++ run_test! do |response|+ expect(JSON.parse(response.body)['error']['code']).to eq('tax_id_not_validatable')+ end+ end+ end+ endenddiff --git a/spree/api/spec/integration/spree/api/v3/admin/digital_links_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/digital_links_spec.rbindex d6bfeb1c13..9a64923b52 100644--- a/spree/api/spec/integration/spree/api/v3/admin/digital_links_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/digital_links_spec.rb@@ -78,4 +78,38 @@ RSpec.describe 'Admin Digital Links API', type: :request, swagger_doc: 'api-refeendendend++ path '/api/v3/admin/digital_links/{id}/reset' do+ parameter name: :id, in: :path, type: :string, required: true, description: 'Digital link ID'++ patch 'Reset a digital link' do+ tags 'Orders'+ admin_sdk_example 'digital-links/reset'+ produces 'application/json'+ security [api_key: [], bearer_auth: []]+ description <<~DESC+ Gives the customer their full download allowance back and restarts the+ link's expiry clock. Use it when a download failed, or the file was+ replaced after the customer had used up their attempts.+ DESC+ admin_scope :write, :orders++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true,+ description: 'Bearer token for admin authentication'++ response '200', 'digital link reset' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }+ let(:id) { digital_link.prefixed_id }++ before { digital_link.update_column(:access_counter, 5) }++ schema '$ref' => '#/components/schemas/DigitalLink'++ run_test! do |response|+ expect(JSON.parse(response.body)['access_counter']).to eq(0)+ end+ end+ end+ endenddiff --git a/spree/api/spec/integration/spree/api/v3/admin/exchanges_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/exchanges_spec.rbindex 0ad19f4d02..52a7f14999 100644--- a/spree/api/spec/integration/spree/api/v3/admin/exchanges_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/exchanges_spec.rb@@ -134,6 +134,41 @@ RSpec.describe 'Admin Exchanges API', type: :request, swagger_doc: 'api-referencendend+ path '/api/v3/admin/orders/{order_id}/exchanges/{id}/approve' do+ patch 'Approve an exchange' do+ tags 'Orders'+ admin_sdk_example 'order-exchanges/approve'+ produces 'application/json'+ security [api_key: [], bearer_auth: []]+ description 'Accepts a requested exchange so the customer can send the goods back for their replacement. Only a requested exchange can be approved; receive it once the goods arrive.'+ admin_scope :write, :orders++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true+ parameter name: :order_id, in: :path, type: :string, required: true, description: 'Order prefixed ID'+ parameter name: :id, in: :path, type: :string, required: true, description: 'Exchange prefixed ID'++ response '200', 'exchange approved' do+ let(:id) { record.prefixed_id }++ schema '$ref' => '#/components/schemas/Exchange'++ run_test! do |response|+ expect(JSON.parse(response.body)['status']).to eq('approved')+ end+ end++ response '422', 'the exchange is not requested' do+ let!(:record) { create(:approved_exchange, order: create(:shipped_order, store: store)) }+ let(:id) { record.prefixed_id }++ schema '$ref' => '#/components/schemas/ErrorResponse'++ run_test!+ end+ end+ end+path '/api/v3/admin/orders/{order_id}/exchanges/{id}/receive' dopatch 'Receive an exchange' dotags 'Orders'diff --git a/spree/api/spec/integration/spree/api/v3/admin/orders_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/orders_spec.rbindex 4deb72d3aa..8460827d4b 100644--- a/spree/api/spec/integration/spree/api/v3/admin/orders_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/orders_spec.rb@@ -347,4 +347,40 @@ RSpec.describe 'Admin Orders API', type: :request, swagger_doc: 'api-reference/aendendend++ path '/api/v3/admin/orders/{id}/resend_digital_links' do+ post 'Resend digital download links' do+ tags 'Orders'+ admin_sdk_example 'orders/resend-digital-links'+ produces 'application/json'+ security [api_key: [], bearer_auth: []]+ description <<~DESC+ Emails the customer their download links for the digital products on+ this order again. Nothing is sent when the order has no digital links or+ the store does not send transactional emails. Use it when the original+ email was lost; to restore used-up downloads or an expired link, reset+ the digital link instead.+ DESC+ admin_scope :write, :orders++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true,+ description: 'Bearer token for admin authentication'+ parameter name: :id, in: :path, type: :string, required: true,+ description: 'Order ID'++ response '200', 'digital links resent' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }+ let!(:order) { create(:completed_order_with_totals, store: store) }+ let(:id) { order.prefixed_id }++ schema '$ref' => '#/components/schemas/Order'++ run_test! do |response|+ data = JSON.parse(response.body)+ expect(data['id']).to eq(order.prefixed_id)+ end+ end+ end+ endenddiff --git a/spree/api/spec/integration/spree/api/v3/admin/products_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/products_spec.rbindex e32c3b3f57..d9fcce3619 100644--- a/spree/api/spec/integration/spree/api/v3/admin/products_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/products_spec.rb@@ -225,6 +225,41 @@ RSpec.describe 'Admin Products API', type: :request, swagger_doc: 'api-referenceendend+ path '/api/v3/admin/products/{id}/clone' do+ parameter name: :id, in: :path, type: :string, required: true, description: 'Product ID'++ post 'Clone a product' do+ tags 'Products'+ admin_sdk_example 'products/clone'+ produces 'application/json'+ security [api_key: [], bearer_auth: []]+ description <<~DESC+ Creates a draft copy of a product, named "COPY OF …", with its variants,+ prices, stock locations, images, categories, channels and tags; stock on+ hand starts at zero. Use it to start a similar product from an existing+ one instead of building it from scratch.+ DESC+ admin_scope :write, :products++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true++ response '201', 'product cloned' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }+ let(:id) { product.prefixed_id }++ schema '$ref' => '#/components/schemas/Product'++ run_test! do |response|+ data = JSON.parse(response.body)+ expect(data['id']).not_to eq(product.prefixed_id)+ expect(data['name']).to eq("COPY OF #{product.name}")+ expect(data['status']).to eq('draft')+ end+ end+ end+ end+path '/api/v3/admin/products/bulk_status_update' dopost 'Bulk-update product status' dotags 'Products'diff --git a/spree/api/spec/integration/spree/api/v3/admin/returns_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/returns_spec.rbindex 58372fe191..ab6f72a430 100644--- a/spree/api/spec/integration/spree/api/v3/admin/returns_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/returns_spec.rb@@ -1,6 +1,7 @@# frozen_string_literal: truerequire 'swagger_helper'+require 'spree/testing_support/label_provider'RSpec.describe 'Admin Returns API', type: :request, swagger_doc: 'api-reference/admin.yaml' doinclude_context 'API v3 Admin'@@ -138,6 +139,41 @@ RSpec.describe 'Admin Returns API', type: :request, swagger_doc: 'api-reference/endend+ path '/api/v3/admin/orders/{order_id}/returns/{id}/approve' do+ patch 'Approve a return' do+ tags 'Orders'+ admin_sdk_example 'order-returns/approve'+ produces 'application/json'+ security [api_key: [], bearer_auth: []]+ description 'Accepts a requested return so the customer can send the goods back. Only a requested return can be approved; receive it once the goods arrive.'+ admin_scope :write, :orders++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true+ parameter name: :order_id, in: :path, type: :string, required: true, description: 'Order prefixed ID'+ parameter name: :id, in: :path, type: :string, required: true, description: 'Return prefixed ID'++ response '200', 'return approved' do+ let(:id) { record.prefixed_id }++ schema '$ref' => '#/components/schemas/Return'++ run_test! do |response|+ expect(JSON.parse(response.body)['status']).to eq('approved')+ end+ end++ response '422', 'the return is not requested' do+ let!(:record) { create(:approved_return, order: create(:shipped_order, store: store)) }+ let(:id) { record.prefixed_id }++ schema '$ref' => '#/components/schemas/ErrorResponse'++ run_test!+ end+ end+ end+path '/api/v3/admin/orders/{order_id}/returns/{id}/receive' dopatch 'Receive a return' dotags 'Orders'@@ -263,4 +299,50 @@ RSpec.describe 'Admin Returns API', type: :request, swagger_doc: 'api-reference/endendend++ path '/api/v3/admin/orders/{order_id}/returns/{return_id}/labels/{id}/refund' do+ patch 'Refund a return label' do+ tags 'Orders'+ admin_sdk_example 'order-returns/labels-refund'+ produces 'application/json'+ security [api_key: [], bearer_auth: []]+ description 'Asks the carrier to refund a purchased return label the customer never used, such as when the return is canceled. An uploaded label has nothing to refund.'+ admin_scope :write, :orders++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true+ parameter name: :order_id, in: :path, type: :string, required: true, description: 'Order prefixed ID'+ parameter name: :return_id, in: :path, type: :string, required: true, description: 'Return prefixed ID'+ parameter name: :id, in: :path, type: :string, required: true, description: 'Shipping label prefixed ID'++ let(:order_id) { record.order.prefixed_id }+ let(:return_id) { record.prefixed_id }+ let(:id) { label.prefixed_id }++ response '200', 'refund filed' do+ let!(:label) { create(:shipping_label, owner: record, store: store) }++ # The carrier is the return's provider; the test double settles the+ # refund at once instead of calling a real carrier account.+ before do+ allow_any_instance_of(Spree::Return).to receive(:provider).+ and_return(Spree::TestingSupport::LabelProvider.new)+ end++ schema '$ref' => '#/components/schemas/ShippingLabel'++ run_test! do |response|+ expect(JSON.parse(response.body)['status']).to eq('refunded')+ end+ end++ response '422', 'uploaded labels cannot be refunded' do+ let!(:label) { create(:shipping_label, :uploaded, owner: record, store: store) }++ schema '$ref' => '#/components/schemas/ErrorResponse'++ run_test!+ end+ end+ endenddiff --git a/spree/api/spec/integration/spree/api/v3/admin/sellers_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/sellers_spec.rbindex 29815575a4..fd1eea3b7a 100644--- a/spree/api/spec/integration/spree/api/v3/admin/sellers_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/admin/sellers_spec.rb@@ -265,6 +265,53 @@ RSpec.describe 'Admin Sellers API', type: :request, swagger_doc: 'api-reference/endend+ path '/api/v3/admin/sellers/{seller_id}/invitations/{id}/resend' do+ parameter name: :seller_id, in: :path, type: :string, required: true, description: 'Seller prefixed ID'+ parameter name: :id, in: :path, type: :string, required: true, description: 'Invitation prefixed ID'++ patch 'Resend a seller invitation' do+ tags 'Sellers'+ admin_sdk_example 'sellers/invitations-resend'+ produces 'application/json'+ security [api_key: [], bearer_auth: []]+ description <<~DESC+ Sends a pending invitation to the seller's team again, with a fresh+ acceptance link. Use it when the email never arrived; an invitation that+ has expired is refused, so invite the person again instead.+ DESC+ admin_scope :write, :sellers++ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true+ parameter name: :Authorization, in: :header, type: :string, required: true++ let(:invitation) do+ create(:invitation, resource: seller, role: seller.default_user_role, inviter: admin_user)+ end+ let(:seller_id) { seller.prefixed_id }+ let(:id) { invitation.prefixed_id }++ response '200', 'invitation resent' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }++ schema '$ref' => '#/components/schemas/Invitation'++ run_test! do |response|+ expect(JSON.parse(response.body)['id']).to eq(invitation.prefixed_id)+ end+ end++ response '422', 'the invitation has expired' do+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }++ before { invitation.update_column(:expires_at, 1.day.ago) }++ schema '$ref' => '#/components/schemas/ErrorResponse'++ run_test!+ end+ end+ end+path '/api/v3/admin/sellers/{id}/approve' doparameter name: :id, in: :path, type: :string, required: true, description: 'Seller prefixed ID'