cURL
curl -X PATCH https://api.neuraldraft.io/v1/products/32/variants/72 \
-H "Authorization: Bearer ndsk_live_yourkey" \
-H "Content-Type: application/json" \
-d '{"stock_quantity":4}'await nd.products.variants.update(32, 72, { stockQuantity: 4 });
requests.patch("https://api.neuraldraft.io/v1/products/32/variants/72",
headers={"Authorization": f"Bearer {key}"}, json={"stock_quantity":4})
<?php
$client->patch('products/32/variants/72', [
'headers' => ['Authorization' => 'Bearer '.$key],
'json' => ['stock_quantity' => 4],
]);
{
"id": 71,
"product_id": 32,
"name": "Natural cork",
"price": 2999,
"sku": "ND-CORK-PAIR-N",
"stock_quantity": 123,
"options": {
"color": "natural"
},
"sort_order": 0,
"is_active": true
}{
"type": "https://api.neuraldraft.io/errors/bad_request",
"title": "Bad request",
"status": 400,
"detail": "Request body could not be parsed.",
"code": "bad_request",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "API key missing or invalid.",
"code": "unauthorized",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/not_found",
"title": "Not found",
"status": 404,
"detail": "No such resource.",
"code": "not_found",
"instance": "req_2Nh4PqRsTuVw"
}Commerce
Update a product variant
PATCH
/
products
/
{id}
/
variants
/
{variant_id}
cURL
curl -X PATCH https://api.neuraldraft.io/v1/products/32/variants/72 \
-H "Authorization: Bearer ndsk_live_yourkey" \
-H "Content-Type: application/json" \
-d '{"stock_quantity":4}'await nd.products.variants.update(32, 72, { stockQuantity: 4 });
requests.patch("https://api.neuraldraft.io/v1/products/32/variants/72",
headers={"Authorization": f"Bearer {key}"}, json={"stock_quantity":4})
<?php
$client->patch('products/32/variants/72', [
'headers' => ['Authorization' => 'Bearer '.$key],
'json' => ['stock_quantity' => 4],
]);
{
"id": 71,
"product_id": 32,
"name": "Natural cork",
"price": 2999,
"sku": "ND-CORK-PAIR-N",
"stock_quantity": 123,
"options": {
"color": "natural"
},
"sort_order": 0,
"is_active": true
}{
"type": "https://api.neuraldraft.io/errors/bad_request",
"title": "Bad request",
"status": 400,
"detail": "Request body could not be parsed.",
"code": "bad_request",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "API key missing or invalid.",
"code": "unauthorized",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/not_found",
"title": "Not found",
"status": 404,
"detail": "No such resource.",
"code": "not_found",
"instance": "req_2Nh4PqRsTuVw"
}Authorizations
Project API key. Pass as Authorization: Bearer ndsk_live_.... Manage
keys via /projects/me/api-keys. Test-mode keys use
the ndsk_test_ prefix.
Body
application/json
Response
Updated.
Example:
71
Example:
32
Example:
"Natural cork"
Example:
2999
Example:
"ND-CORK-PAIR-N"
Free-form variant options (size, color, etc.).
Show child attributes
Show child attributes
Example:
{ "color": "natural" }