cURL
curl -X POST https://api.neuraldraft.io/v1/products/32/variants \
-H "Authorization: Bearer ndsk_live_yourkey" \
-H "Content-Type: application/json" \
-d '{"name":"Charcoal cork","price":3299,"sku":"ND-CORK-PAIR-C","stock_quantity":6,"options":{"color":"charcoal"}}'await nd.products.variants.create(32, { name:"Charcoal cork", price:3299, sku:"ND-CORK-PAIR-C", stockQuantity:6, options:{color:"charcoal"} });
requests.post("https://api.neuraldraft.io/v1/products/32/variants",
headers={"Authorization": f"Bearer {key}"},
json={"name":"Charcoal cork","price":3299,"sku":"ND-CORK-PAIR-C","stock_quantity":6,"options":{"color":"charcoal"}})
<?php
$client->post('products/32/variants', [
'headers' => ['Authorization' => 'Bearer '.$key],
'json' => ['name'=>'Charcoal cork','price'=>3299,'sku'=>'ND-CORK-PAIR-C','stock_quantity'=>6,'options'=>['color'=>'charcoal']],
]);
{
"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"
}{
"type": "https://api.neuraldraft.io/errors/conflict",
"title": "Conflict",
"status": 409,
"detail": "A resource with this slug already exists.",
"code": "conflict",
"instance": "req_2Nh4PqRsTuVw"
}Commerce
Create a product variant
POST
/
products
/
{id}
/
variants
cURL
curl -X POST https://api.neuraldraft.io/v1/products/32/variants \
-H "Authorization: Bearer ndsk_live_yourkey" \
-H "Content-Type: application/json" \
-d '{"name":"Charcoal cork","price":3299,"sku":"ND-CORK-PAIR-C","stock_quantity":6,"options":{"color":"charcoal"}}'await nd.products.variants.create(32, { name:"Charcoal cork", price:3299, sku:"ND-CORK-PAIR-C", stockQuantity:6, options:{color:"charcoal"} });
requests.post("https://api.neuraldraft.io/v1/products/32/variants",
headers={"Authorization": f"Bearer {key}"},
json={"name":"Charcoal cork","price":3299,"sku":"ND-CORK-PAIR-C","stock_quantity":6,"options":{"color":"charcoal"}})
<?php
$client->post('products/32/variants', [
'headers' => ['Authorization' => 'Bearer '.$key],
'json' => ['name'=>'Charcoal cork','price'=>3299,'sku'=>'ND-CORK-PAIR-C','stock_quantity'=>6,'options'=>['color'=>'charcoal']],
]);
{
"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"
}{
"type": "https://api.neuraldraft.io/errors/conflict",
"title": "Conflict",
"status": 409,
"detail": "A resource with this slug already exists.",
"code": "conflict",
"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.
Path Parameters
Example:
32
Body
application/json
Response
Created.
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" }