Update
curl --request PATCH \
--url https://{defaultHost}/v1/variants/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"variant": {
"sku": "abc-123-xyz",
"dimensions": {
"length": 15,
"width": 10,
"height": 6,
"unit": "in"
},
"hs_code": "6109.10",
"country_of_origin": "US",
"manufacturer_code": "ACME-TS",
"google_product_data": {
"gtin": "036000291452",
"size": "M",
"color": "Red"
}
}
}
'import requests
url = "https://{defaultHost}/v1/variants/{id}"
payload = { "variant": {
"sku": "abc-123-xyz",
"dimensions": {
"length": 15,
"width": 10,
"height": 6,
"unit": "in"
},
"hs_code": "6109.10",
"country_of_origin": "US",
"manufacturer_code": "ACME-TS",
"google_product_data": {
"gtin": "036000291452",
"size": "M",
"color": "Red"
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
variant: {
sku: 'abc-123-xyz',
dimensions: {length: 15, width: 10, height: 6, unit: 'in'},
hs_code: '6109.10',
country_of_origin: 'US',
manufacturer_code: 'ACME-TS',
google_product_data: {gtin: '036000291452', size: 'M', color: 'Red'}
}
})
};
fetch('https://{defaultHost}/v1/variants/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/v1/variants/{id}",
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([
'variant' => [
'sku' => 'abc-123-xyz',
'dimensions' => [
'length' => 15,
'width' => 10,
'height' => 6,
'unit' => 'in'
],
'hs_code' => '6109.10',
'country_of_origin' => 'US',
'manufacturer_code' => 'ACME-TS',
'google_product_data' => [
'gtin' => '036000291452',
'size' => 'M',
'color' => 'Red'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{defaultHost}/v1/variants/{id}"
payload := strings.NewReader("{\n \"variant\": {\n \"sku\": \"abc-123-xyz\",\n \"dimensions\": {\n \"length\": 15,\n \"width\": 10,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"hs_code\": \"6109.10\",\n \"country_of_origin\": \"US\",\n \"manufacturer_code\": \"ACME-TS\",\n \"google_product_data\": {\n \"gtin\": \"036000291452\",\n \"size\": \"M\",\n \"color\": \"Red\"\n }\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.patch("https://{defaultHost}/v1/variants/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variant\": {\n \"sku\": \"abc-123-xyz\",\n \"dimensions\": {\n \"length\": 15,\n \"width\": 10,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"hs_code\": \"6109.10\",\n \"country_of_origin\": \"US\",\n \"manufacturer_code\": \"ACME-TS\",\n \"google_product_data\": {\n \"gtin\": \"036000291452\",\n \"size\": \"M\",\n \"color\": \"Red\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/variants/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variant\": {\n \"sku\": \"abc-123-xyz\",\n \"dimensions\": {\n \"length\": 15,\n \"width\": 10,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"hs_code\": \"6109.10\",\n \"country_of_origin\": \"US\",\n \"manufacturer_code\": \"ACME-TS\",\n \"google_product_data\": {\n \"gtin\": \"036000291452\",\n \"size\": \"M\",\n \"color\": \"Red\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "d616a8c7-f9a0-4b61-82ec-cf8ee67864c1",
"object": "variant",
"amount": null,
"available_stock": 0,
"allow_out_of_stock_purchases": null,
"auto_fulfill_enabled": null,
"currency": "usd",
"current_version": true,
"dimensions": {
"length": 15,
"width": 10,
"height": 6,
"unit": "in"
},
"downloads_enabled": true,
"held_stock": 0,
"license_activation_limit": null,
"metadata": {},
"option_1": "Blue",
"option_2": null,
"option_3": null,
"option_names": [
"Color"
],
"position": 0,
"purchase_limit": null,
"shipping_enabled": null,
"sku": "abc-123-xyz",
"stock": 0,
"stock_enabled": null,
"tax_category": null,
"tax_enabled": null,
"weight_unit": null,
"hs_code": "6109.10",
"country_of_origin": "US",
"manufacturer_code": "ACME-TS",
"google_product_data": {
"gtin": "036000291452",
"mpn": null,
"condition": null,
"age_group": null,
"gender": null,
"color": "Red",
"size": "M",
"size_type": null,
"size_system": null,
"material": null,
"pattern": null
},
"weight": null,
"current_release_download": null,
"image": null,
"product": "27bddd78-c449-4042-aba5-b435f326226e",
"created_at": 1796064006,
"updated_at": 1796064006
}Variants
Update
Updates a specific variant.
PATCH
/
v1
/
variants
/
{id}
Update
curl --request PATCH \
--url https://{defaultHost}/v1/variants/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"variant": {
"sku": "abc-123-xyz",
"dimensions": {
"length": 15,
"width": 10,
"height": 6,
"unit": "in"
},
"hs_code": "6109.10",
"country_of_origin": "US",
"manufacturer_code": "ACME-TS",
"google_product_data": {
"gtin": "036000291452",
"size": "M",
"color": "Red"
}
}
}
'import requests
url = "https://{defaultHost}/v1/variants/{id}"
payload = { "variant": {
"sku": "abc-123-xyz",
"dimensions": {
"length": 15,
"width": 10,
"height": 6,
"unit": "in"
},
"hs_code": "6109.10",
"country_of_origin": "US",
"manufacturer_code": "ACME-TS",
"google_product_data": {
"gtin": "036000291452",
"size": "M",
"color": "Red"
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
variant: {
sku: 'abc-123-xyz',
dimensions: {length: 15, width: 10, height: 6, unit: 'in'},
hs_code: '6109.10',
country_of_origin: 'US',
manufacturer_code: 'ACME-TS',
google_product_data: {gtin: '036000291452', size: 'M', color: 'Red'}
}
})
};
fetch('https://{defaultHost}/v1/variants/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/v1/variants/{id}",
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([
'variant' => [
'sku' => 'abc-123-xyz',
'dimensions' => [
'length' => 15,
'width' => 10,
'height' => 6,
'unit' => 'in'
],
'hs_code' => '6109.10',
'country_of_origin' => 'US',
'manufacturer_code' => 'ACME-TS',
'google_product_data' => [
'gtin' => '036000291452',
'size' => 'M',
'color' => 'Red'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{defaultHost}/v1/variants/{id}"
payload := strings.NewReader("{\n \"variant\": {\n \"sku\": \"abc-123-xyz\",\n \"dimensions\": {\n \"length\": 15,\n \"width\": 10,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"hs_code\": \"6109.10\",\n \"country_of_origin\": \"US\",\n \"manufacturer_code\": \"ACME-TS\",\n \"google_product_data\": {\n \"gtin\": \"036000291452\",\n \"size\": \"M\",\n \"color\": \"Red\"\n }\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.patch("https://{defaultHost}/v1/variants/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variant\": {\n \"sku\": \"abc-123-xyz\",\n \"dimensions\": {\n \"length\": 15,\n \"width\": 10,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"hs_code\": \"6109.10\",\n \"country_of_origin\": \"US\",\n \"manufacturer_code\": \"ACME-TS\",\n \"google_product_data\": {\n \"gtin\": \"036000291452\",\n \"size\": \"M\",\n \"color\": \"Red\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/variants/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variant\": {\n \"sku\": \"abc-123-xyz\",\n \"dimensions\": {\n \"length\": 15,\n \"width\": 10,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"hs_code\": \"6109.10\",\n \"country_of_origin\": \"US\",\n \"manufacturer_code\": \"ACME-TS\",\n \"google_product_data\": {\n \"gtin\": \"036000291452\",\n \"size\": \"M\",\n \"color\": \"Red\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "d616a8c7-f9a0-4b61-82ec-cf8ee67864c1",
"object": "variant",
"amount": null,
"available_stock": 0,
"allow_out_of_stock_purchases": null,
"auto_fulfill_enabled": null,
"currency": "usd",
"current_version": true,
"dimensions": {
"length": 15,
"width": 10,
"height": 6,
"unit": "in"
},
"downloads_enabled": true,
"held_stock": 0,
"license_activation_limit": null,
"metadata": {},
"option_1": "Blue",
"option_2": null,
"option_3": null,
"option_names": [
"Color"
],
"position": 0,
"purchase_limit": null,
"shipping_enabled": null,
"sku": "abc-123-xyz",
"stock": 0,
"stock_enabled": null,
"tax_category": null,
"tax_enabled": null,
"weight_unit": null,
"hs_code": "6109.10",
"country_of_origin": "US",
"manufacturer_code": "ACME-TS",
"google_product_data": {
"gtin": "036000291452",
"mpn": null,
"condition": null,
"age_group": null,
"gender": null,
"color": "Red",
"size": "M",
"size_type": null,
"size_system": null,
"material": null,
"pattern": null
},
"weight": null,
"current_release_download": null,
"image": null,
"product": "27bddd78-c449-4042-aba5-b435f326226e",
"created_at": 1796064006,
"updated_at": 1796064006
}Authorizations
Response
200 - application/json
Success
Whether or not downloads are enabled for this variant. When false, downloads will be disabled for this variant. When true, the downloads that are set for this variant will override the product downloads. If no downloads are set, then the product downloads will be used.
Expandable – The associated download ID.
Expandable – The associated media ID.
Expandable – The associated product ID.
Was this page helpful?