Skip to main content
PUT
/
api
/
external
/
v2
/
subscription-groups
/
{id}
/
add-products
Add products or variants to an existing subscription group
curl --request PUT \
  --url https://subscription-admin.appstle.com/api/external/v2/subscription-groups/{id}/add-products \
  --header 'X-API-Key: <x-api-key>'
import requests

url = "https://subscription-admin.appstle.com/api/external/v2/subscription-groups/{id}/add-products"

headers = {"X-API-Key": "<x-api-key>"}

response = requests.put(url, headers=headers)

print(response.text)
const options = {method: 'PUT', headers: {'X-API-Key': '<x-api-key>'}};

fetch('https://subscription-admin.appstle.com/api/external/v2/subscription-groups/{id}/add-products', 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/subscription-groups/{id}/add-products';
const options = {method: 'PUT', headers: {'X-API-Key': '<x-api-key>'}};

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/subscription-groups/{id}/add-products",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"X-API-Key: <x-api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://subscription-admin.appstle.com/api/external/v2/subscription-groups/{id}/add-products"

req, _ := http.NewRequest("PUT", url, nil)

req.Header.Add("X-API-Key", "<x-api-key>")

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/subscription-groups/{id}/add-products")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<x-api-key>'

response = http.request(request)
puts response.read_body
{
  "groupName": "Monthly Coffee Subscription",
  "id": 123456789,
  "productCount": 10,
  "productIds": "[{\"id\":987654321,\"title\":\"Premium Coffee Blend\"},{\"id\":987654322,\"title\":\"Organic Dark Roast\"},{\"id\":987654323,\"title\":\"Colombian Single Origin\"}]",
  "productVariantCount": 35,
  "subscriptionPlans": [
    {
      "discountEnabled": true,
      "discountOffer": 10,
      "discountType": "PERCENTAGE",
      "frequencyCount": 1,
      "frequencyDescription": "Get fresh coffee delivered to your door every month",
      "frequencyInterval": "MONTH",
      "frequencyName": "Delivered Monthly",
      "id": "gid://shopify/SellingPlan/111111",
      "planType": "PAY_AS_YOU_GO"
    }
  ],
  "variantIds": "[{\"id\":123456789,\"title\":\"250g Bag\"},{\"id\":123456790,\"title\":\"500g Bag\"}]"
}

Headers

X-API-Key
string
required

API Key for authentication

x-return-short-response
boolean
default:false

Header to indicate if response should return only added products ID information. Set to 'true' for minimal response, any other value or omitted for full response.

Path Parameters

id
integer<int64>
required

Subscription group ID (numeric ID)

Query Parameters

api_key
string

API Key (Deprecated - Use X-API-Key header instead)

productIds
string

Comma-separated list of Shopify product IDs to add. Adding a product makes all its variants eligible for subscription. Use numeric IDs only (e.g., '987654321,987654322,987654323')

Pattern: ^\d+(,\d+)*$
variantIds
string

Comma-separated list of Shopify variant IDs to add. Use this to enable subscription for specific variants only. Use numeric IDs only (e.g., '123456789,123456790,123456791')

Pattern: ^\d+(,\d+)*$

Response

Products/variants successfully added to subscription group

accessoryProductIds
string
deleteProducts
object
groupName
string
id
integer<int64>
productCount
integer<int64>
productId
string
productIds
string
productVariantCount
integer<int64>
subscriptionPlans
object[]
translations
string
updateProducts
object
variantIds
string