Product Catalog
Update an existing product swap automation
deprecated
Updates an existing product swap automation rule for the authenticated shop. Use this endpoint to modify swap configurations, change source/destination products, adjust timing, or update discount handling.
Required Fields:
- id: The product swap ID to update
- shop: Your Shopify shop domain (must match authenticated shop)
Updatable Fields:
- sourceVariants: JSON string of variants to swap FROM
- destinationVariants: JSON string of variants to swap TO
- name: Descriptive name for this swap rule
- forBillingCycle: Specific cycle number when swap occurs (null for recurring)
- checkForEveryRecurringOrder: If true, applies swap to every order
- updatedFirstOrder: If true, can affect the first subscription order
- changeNextOrderDateBy: Days to adjust next order date after swap
- discountCarryForward: How to handle discounts (NONE, PERCENTAGE, FIXED_AMOUNT, PRICE)
- carryDiscountForward: Legacy boolean field (use discountCarryForward instead)
- stopSwapEmails: If true, suppresses customer notification emails
- ruleSequence: Priority order (lower number = higher priority)
Impact of Updates:
- Changes apply to future orders immediately
- Past orders and already-swapped products are not affected
- If changing forBillingCycle, recalculates which subscriptions are affected
- Variant data is automatically enriched from Shopify on update
Authentication: Requires valid X-API-Key header
PUT
/
api
/
external
/
v2
/
product-swaps
Update an existing product swap automation
curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/product-swaps \
--header 'Content-Type: application/json' \
--data '
{
"shop": "example-shop"
}
'import requests
url = "https://subscription-admin.appstle.com/api/external/v2/product-swaps"
payload = { "shop": "example-shop" }
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({shop: 'example-shop'})
};
fetch('https://subscription-admin.appstle.com/api/external/v2/product-swaps', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://subscription-admin.appstle.com/api/external/v2/product-swaps';
const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({shop: 'example-shop'})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://subscription-admin.appstle.com/api/external/v2/product-swaps",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'shop' => 'example-shop'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://subscription-admin.appstle.com/api/external/v2/product-swaps"
payload := strings.NewReader("{\n \"shop\": \"example-shop\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://subscription-admin.appstle.com/api/external/v2/product-swaps")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"shop\": \"example-shop\"\n}"
response = http.request(request)
puts response.read_body{
"carryDiscountForward": false,
"changeNextOrderDateBy": null,
"checkForEveryRecurringOrder": false,
"destinationVariants": "[{\"id\":67890,\"displayName\":\"test-product\",\"imageSrc\":\"https://test.com/image.png\",\"quantity\":2}]",
"discountCarryForward": "NONE",
"forBillingCycle": 2,
"id": 10782,
"name": "swap test",
"ruleSequence": 0,
"shop": "example-shop",
"sourceVariants": "[{\"id\":12345,\"displayName\":\"test-product\",\"imageSrc\":\"https://test.com/image.png\",\"quantity\":2}]",
"stopSwapEmails": false,
"updatedFirstOrder": false
}{
"detail": "Invalid id",
"status": 400,
"title": "Invalid id",
"type": "https://example.com/errors/bad-request"
}{
"detail": "Valid X-API-Key header is required",
"status": 401,
"title": "Authentication required",
"type": "https://example.com/errors/unauthorized"
}{
"detail": "API key does not have permission to update product swaps",
"status": 403,
"title": "Insufficient permissions",
"type": "https://example.com/errors/forbidden"
}{
"detail": "Resource not found",
"status": 404,
"title": "Resource not found",
"type": "https://example.com/errors/not-found"
}{
"detail": "Cannot update product swap due to business rule violation",
"status": 422,
"title": "Business rule violation",
"type": "https://example.com/errors/unprocessable-entity"
}Headers
Body
application/json
ProductSwapDTO payload
Available options:
NONE, EXISTING_PLAN, PRODUCT_PLAN, PRODUCT_THEN_EXISTING Response
Product swap updated successfully
Available options:
NONE, EXISTING_PLAN, PRODUCT_PLAN, PRODUCT_THEN_EXISTING ⌘I
Update an existing product swap automation
curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/product-swaps \
--header 'Content-Type: application/json' \
--data '
{
"shop": "example-shop"
}
'import requests
url = "https://subscription-admin.appstle.com/api/external/v2/product-swaps"
payload = { "shop": "example-shop" }
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({shop: 'example-shop'})
};
fetch('https://subscription-admin.appstle.com/api/external/v2/product-swaps', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://subscription-admin.appstle.com/api/external/v2/product-swaps';
const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({shop: 'example-shop'})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://subscription-admin.appstle.com/api/external/v2/product-swaps",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'shop' => 'example-shop'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://subscription-admin.appstle.com/api/external/v2/product-swaps"
payload := strings.NewReader("{\n \"shop\": \"example-shop\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://subscription-admin.appstle.com/api/external/v2/product-swaps")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"shop\": \"example-shop\"\n}"
response = http.request(request)
puts response.read_body{
"carryDiscountForward": false,
"changeNextOrderDateBy": null,
"checkForEveryRecurringOrder": false,
"destinationVariants": "[{\"id\":67890,\"displayName\":\"test-product\",\"imageSrc\":\"https://test.com/image.png\",\"quantity\":2}]",
"discountCarryForward": "NONE",
"forBillingCycle": 2,
"id": 10782,
"name": "swap test",
"ruleSequence": 0,
"shop": "example-shop",
"sourceVariants": "[{\"id\":12345,\"displayName\":\"test-product\",\"imageSrc\":\"https://test.com/image.png\",\"quantity\":2}]",
"stopSwapEmails": false,
"updatedFirstOrder": false
}{
"detail": "Invalid id",
"status": 400,
"title": "Invalid id",
"type": "https://example.com/errors/bad-request"
}{
"detail": "Valid X-API-Key header is required",
"status": 401,
"title": "Authentication required",
"type": "https://example.com/errors/unauthorized"
}{
"detail": "API key does not have permission to update product swaps",
"status": 403,
"title": "Insufficient permissions",
"type": "https://example.com/errors/forbidden"
}{
"detail": "Resource not found",
"status": 404,
"title": "Resource not found",
"type": "https://example.com/errors/not-found"
}{
"detail": "Cannot update product swap due to business rule violation",
"status": 422,
"title": "Business rule violation",
"type": "https://example.com/errors/unprocessable-entity"
}