Update line item attributes for a subscription contract
Replaces the custom attributes (line item properties) of one line in a subscription contract with exactly the list you send. Any attribute you leave out is removed, Appstle’s own included. To change one attribute, read the line’s current customAttributes first (GET /api/external/v2/subscription-contracts/contract-external/{contractId} returns them in lines.nodes), then send the complete list with your change. An empty list removes all of the line’s attributes. A Build-A-Box line stores the box in five attributes (products, _appstle-bb-id, __appstle-bb-name, _appstle-bb-product-sku and __appstle-bb-variants), and a one-time line carries _appstle-one-time-product: leave that out and the line is no longer removed after the next order. The call acts as the merchant, so none of the customer portal’s rules apply: not the editing setting, the product-change window, the minimum-cycle freeze or the box’s limits. Authenticate with the X-API-Key header. The api_key query parameter is deprecated.
curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-update-line-item-attributes \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
[
{
"key": "license_key",
"value": "AAA-111"
},
{
"key": "gift_note",
"value": "For Sam"
}
]
'import requests
url = "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-update-line-item-attributes"
payload = [
{
"key": "license_key",
"value": "AAA-111"
},
{
"key": "gift_note",
"value": "For Sam"
}
]
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([{key: 'license_key', value: 'AAA-111'}, {key: 'gift_note', value: 'For Sam'}])
};
fetch('https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-update-line-item-attributes', 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-contracts-update-line-item-attributes';
const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([{key: 'license_key', value: 'AAA-111'}, {key: 'gift_note', value: 'For Sam'}])
};
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-contracts-update-line-item-attributes",
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([
[
'key' => 'license_key',
'value' => 'AAA-111'
],
[
'key' => 'gift_note',
'value' => 'For Sam'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-update-line-item-attributes"
payload := strings.NewReader("[\n {\n \"key\": \"license_key\",\n \"value\": \"AAA-111\"\n },\n {\n \"key\": \"gift_note\",\n \"value\": \"For Sam\"\n }\n]")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
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/subscription-contracts-update-line-item-attributes")
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>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"key\": \"license_key\",\n \"value\": \"AAA-111\"\n },\n {\n \"key\": \"gift_note\",\n \"value\": \"For Sam\"\n }\n]"
response = http.request(request)
puts response.read_body{
"__typename": "SubscriptionContract",
"customer": {
"__typename": "Customer",
"displayName": "Jane Cooper",
"email": "jane.cooper@example.com",
"id": "gid://shopify/Customer/7890123456789"
},
"id": "gid://shopify/SubscriptionContract/123456789",
"lines": {
"__typename": "SubscriptionLineConnection",
"nodes": [
{
"__typename": "SubscriptionLine",
"customAttributes": [
{
"__typename": "Attribute",
"key": "gift_note",
"value": "For Sam"
},
{
"__typename": "Attribute",
"key": "license_key",
"value": "AAA-111"
}
],
"id": "gid://shopify/SubscriptionLine/2f8c1d4e-7a3b-4c19-9d5e-6b0a1c2d3e4f",
"quantity": 1,
"sellingPlanName": "Weekly Subscription",
"title": "The Videographer Snowboard",
"variantId": "gid://shopify/ProductVariant/45678901234567"
}
]
},
"nextBillingDate": "2026-11-16T14:00:00Z",
"status": "PAUSED",
"updatedAt": "2026-11-13T22:04:08Z"
}Query Parameters
Body
The line's complete list of attributes as key and value pairs. It replaces all of the line's attributes: include every attribute the line should keep, because any you leave out are removed. Send an empty list to remove them all.
Response
The contract after the change, with each line's attributes in lines.nodes[].customAttributes. The example is shortened: the response also has the contract's other fields, such as billingPolicy, deliveryPolicy, discounts and the contract's own customAttributes (which this call doesn't change), and more fields on each line and on the customer.
curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-update-line-item-attributes \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
[
{
"key": "license_key",
"value": "AAA-111"
},
{
"key": "gift_note",
"value": "For Sam"
}
]
'import requests
url = "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-update-line-item-attributes"
payload = [
{
"key": "license_key",
"value": "AAA-111"
},
{
"key": "gift_note",
"value": "For Sam"
}
]
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([{key: 'license_key', value: 'AAA-111'}, {key: 'gift_note', value: 'For Sam'}])
};
fetch('https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-update-line-item-attributes', 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-contracts-update-line-item-attributes';
const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([{key: 'license_key', value: 'AAA-111'}, {key: 'gift_note', value: 'For Sam'}])
};
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-contracts-update-line-item-attributes",
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([
[
'key' => 'license_key',
'value' => 'AAA-111'
],
[
'key' => 'gift_note',
'value' => 'For Sam'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-update-line-item-attributes"
payload := strings.NewReader("[\n {\n \"key\": \"license_key\",\n \"value\": \"AAA-111\"\n },\n {\n \"key\": \"gift_note\",\n \"value\": \"For Sam\"\n }\n]")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
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/subscription-contracts-update-line-item-attributes")
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>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"key\": \"license_key\",\n \"value\": \"AAA-111\"\n },\n {\n \"key\": \"gift_note\",\n \"value\": \"For Sam\"\n }\n]"
response = http.request(request)
puts response.read_body{
"__typename": "SubscriptionContract",
"customer": {
"__typename": "Customer",
"displayName": "Jane Cooper",
"email": "jane.cooper@example.com",
"id": "gid://shopify/Customer/7890123456789"
},
"id": "gid://shopify/SubscriptionContract/123456789",
"lines": {
"__typename": "SubscriptionLineConnection",
"nodes": [
{
"__typename": "SubscriptionLine",
"customAttributes": [
{
"__typename": "Attribute",
"key": "gift_note",
"value": "For Sam"
},
{
"__typename": "Attribute",
"key": "license_key",
"value": "AAA-111"
}
],
"id": "gid://shopify/SubscriptionLine/2f8c1d4e-7a3b-4c19-9d5e-6b0a1c2d3e4f",
"quantity": 1,
"sellingPlanName": "Weekly Subscription",
"title": "The Videographer Snowboard",
"variantId": "gid://shopify/ProductVariant/45678901234567"
}
]
},
"nextBillingDate": "2026-11-16T14:00:00Z",
"status": "PAUSED",
"updatedAt": "2026-11-13T22:04:08Z"
}