Update a variant
curl --request PATCH \
--url https://app.papelship.com/api/v1/products/{id}/variants/{variantId} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-store-hash: <api-key>' \
--data '
{
"name": "<string>",
"slug": "<string>",
"price_cents": 123,
"discount_percent": 123,
"stock_quantity": 123,
"is_default": true,
"active": true,
"sort_order": 123,
"image_url": "<string>",
"sku": "<string>",
"barcode": "<string>",
"weight_grams": 123,
"compare_at_cents": 123,
"track_inventory": true,
"allow_backorder": true,
"low_stock_threshold": 123,
"option_values": [
"<string>"
]
}
'const options = {
method: 'PATCH',
headers: {
'x-api-key': '<api-key>',
'x-store-hash': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
price_cents: 123,
discount_percent: 123,
stock_quantity: 123,
is_default: true,
active: true,
sort_order: 123,
image_url: '<string>',
sku: '<string>',
barcode: '<string>',
weight_grams: 123,
compare_at_cents: 123,
track_inventory: true,
allow_backorder: true,
low_stock_threshold: 123,
option_values: ['<string>']
})
};
fetch('https://app.papelship.com/api/v1/products/{id}/variants/{variantId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.papelship.com/api/v1/products/{id}/variants/{variantId}"
payload = {
"name": "<string>",
"slug": "<string>",
"price_cents": 123,
"discount_percent": 123,
"stock_quantity": 123,
"is_default": True,
"active": True,
"sort_order": 123,
"image_url": "<string>",
"sku": "<string>",
"barcode": "<string>",
"weight_grams": 123,
"compare_at_cents": 123,
"track_inventory": True,
"allow_backorder": True,
"low_stock_threshold": 123,
"option_values": ["<string>"]
}
headers = {
"x-api-key": "<api-key>",
"x-store-hash": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.papelship.com/api/v1/products/{id}/variants/{variantId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'slug' => '<string>',
'price_cents' => 123,
'discount_percent' => 123,
'stock_quantity' => 123,
'is_default' => true,
'active' => true,
'sort_order' => 123,
'image_url' => '<string>',
'sku' => '<string>',
'barcode' => '<string>',
'weight_grams' => 123,
'compare_at_cents' => 123,
'track_inventory' => true,
'allow_backorder' => true,
'low_stock_threshold' => 123,
'option_values' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-store-hash: <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://app.papelship.com/api/v1/products/{id}/variants/{variantId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"price_cents\": 123,\n \"discount_percent\": 123,\n \"stock_quantity\": 123,\n \"is_default\": true,\n \"active\": true,\n \"sort_order\": 123,\n \"image_url\": \"<string>\",\n \"sku\": \"<string>\",\n \"barcode\": \"<string>\",\n \"weight_grams\": 123,\n \"compare_at_cents\": 123,\n \"track_inventory\": true,\n \"allow_backorder\": true,\n \"low_stock_threshold\": 123,\n \"option_values\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-store-hash", "<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))
}{
"success": true,
"variant": {
"id": 881,
"object": "variant",
"product_id": "AbC123xyz789",
"name": "1 Month",
"slug": "1-month",
"delivery_type": "file",
"price_cents": 999,
"discount_percent": 0,
"compare_at_cents": 123,
"is_default": true,
"active": true,
"sort_order": 123,
"image_url": "<string>",
"stock_mode": "calculated",
"stock_quantity": 123,
"sku": "<string>",
"barcode": "<string>",
"weight_grams": 123,
"track_inventory": true,
"allow_backorder": true,
"low_stock_threshold": 123,
"option_values": [
"<string>"
],
"created_at": "2026-10-04T12:00:00.000Z",
"updated_at": "2026-10-04T12:00:00.000Z"
}
}{
"success": false,
"code": "INVALID_API_KEY",
"error": "Invalid API Key",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "INSUFFICIENT_SCOPE",
"error": "This API key needs the orders:write permission",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "NOT_FOUND",
"error": "Invoice not found",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "INVOICE_PAID",
"error": "A paid order cannot be cancelled. Refund it instead.",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "VALIDATION_FAILED",
"error": "customer_email must be a valid email address",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "RATE_LIMITED",
"error": "Too many requests. The limit is 300 requests per minute per key.",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}Variants & stock
Update a variant
Use /stock/adjust for stock changes.
Permission: products:write
PATCH
/
products
/
{id}
/
variants
/
{variantId}
Update a variant
curl --request PATCH \
--url https://app.papelship.com/api/v1/products/{id}/variants/{variantId} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-store-hash: <api-key>' \
--data '
{
"name": "<string>",
"slug": "<string>",
"price_cents": 123,
"discount_percent": 123,
"stock_quantity": 123,
"is_default": true,
"active": true,
"sort_order": 123,
"image_url": "<string>",
"sku": "<string>",
"barcode": "<string>",
"weight_grams": 123,
"compare_at_cents": 123,
"track_inventory": true,
"allow_backorder": true,
"low_stock_threshold": 123,
"option_values": [
"<string>"
]
}
'const options = {
method: 'PATCH',
headers: {
'x-api-key': '<api-key>',
'x-store-hash': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
price_cents: 123,
discount_percent: 123,
stock_quantity: 123,
is_default: true,
active: true,
sort_order: 123,
image_url: '<string>',
sku: '<string>',
barcode: '<string>',
weight_grams: 123,
compare_at_cents: 123,
track_inventory: true,
allow_backorder: true,
low_stock_threshold: 123,
option_values: ['<string>']
})
};
fetch('https://app.papelship.com/api/v1/products/{id}/variants/{variantId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.papelship.com/api/v1/products/{id}/variants/{variantId}"
payload = {
"name": "<string>",
"slug": "<string>",
"price_cents": 123,
"discount_percent": 123,
"stock_quantity": 123,
"is_default": True,
"active": True,
"sort_order": 123,
"image_url": "<string>",
"sku": "<string>",
"barcode": "<string>",
"weight_grams": 123,
"compare_at_cents": 123,
"track_inventory": True,
"allow_backorder": True,
"low_stock_threshold": 123,
"option_values": ["<string>"]
}
headers = {
"x-api-key": "<api-key>",
"x-store-hash": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.papelship.com/api/v1/products/{id}/variants/{variantId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'slug' => '<string>',
'price_cents' => 123,
'discount_percent' => 123,
'stock_quantity' => 123,
'is_default' => true,
'active' => true,
'sort_order' => 123,
'image_url' => '<string>',
'sku' => '<string>',
'barcode' => '<string>',
'weight_grams' => 123,
'compare_at_cents' => 123,
'track_inventory' => true,
'allow_backorder' => true,
'low_stock_threshold' => 123,
'option_values' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-store-hash: <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://app.papelship.com/api/v1/products/{id}/variants/{variantId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"price_cents\": 123,\n \"discount_percent\": 123,\n \"stock_quantity\": 123,\n \"is_default\": true,\n \"active\": true,\n \"sort_order\": 123,\n \"image_url\": \"<string>\",\n \"sku\": \"<string>\",\n \"barcode\": \"<string>\",\n \"weight_grams\": 123,\n \"compare_at_cents\": 123,\n \"track_inventory\": true,\n \"allow_backorder\": true,\n \"low_stock_threshold\": 123,\n \"option_values\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-store-hash", "<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))
}{
"success": true,
"variant": {
"id": 881,
"object": "variant",
"product_id": "AbC123xyz789",
"name": "1 Month",
"slug": "1-month",
"delivery_type": "file",
"price_cents": 999,
"discount_percent": 0,
"compare_at_cents": 123,
"is_default": true,
"active": true,
"sort_order": 123,
"image_url": "<string>",
"stock_mode": "calculated",
"stock_quantity": 123,
"sku": "<string>",
"barcode": "<string>",
"weight_grams": 123,
"track_inventory": true,
"allow_backorder": true,
"low_stock_threshold": 123,
"option_values": [
"<string>"
],
"created_at": "2026-10-04T12:00:00.000Z",
"updated_at": "2026-10-04T12:00:00.000Z"
}
}{
"success": false,
"code": "INVALID_API_KEY",
"error": "Invalid API Key",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "INSUFFICIENT_SCOPE",
"error": "This API key needs the orders:write permission",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "NOT_FOUND",
"error": "Invoice not found",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "INVOICE_PAID",
"error": "A paid order cannot be cancelled. Refund it instead.",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "VALIDATION_FAILED",
"error": "customer_email must be a valid email address",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}{
"success": false,
"code": "RATE_LIMITED",
"error": "Too many requests. The limit is 300 requests per minute per key.",
"request_id": "req_7YbK2mQ9xP1cRt4v"
}Yetkilendirmeler
Your Store API key (pk_live_...). Create it in Developers › API keys.
The ID of the store the request is for. Shown in Developers › API keys.
Yol Parametreleri
Product hash ID (numeric ID also accepted).
Örnek:
"AbC123xyz789"
Variant ID.
Örnek:
"881"
Gövde
application/json
Digital products only.
Mevcut seçenekler:
file, license null = unlimited. Not for license variants.
Physical only.
Physical only. Must match the product's options.