Create Product

POST /api/v1/products

Required Fields

FieldTypeDescription
namestringProduct name
pricefloatProduct price

Optional Fields

FieldTypeDescription
descriptionstringFull HTML description
product_codestringSKU (auto-generated if empty)
sale_pricefloatSale price (0 = no sale)
stock_levelintQuantity in stock
product_weightfloatWeight for shipping
tax_typeintTax class ID
tax_inclusiveint1 = price includes tax
statusint1 = active, 0 = disabled
categoriesarrayCategory assignments

curl Example

curl -X POST 
     -H "Authorization: Bearer KEY:SECRET" 
     -H "Content-Type: application/json" 
     -d '{"name": "Premium Backpack", "price": 79.99, "stock_level": 50, "status": 1, "categories": [{"cat_id": 5, "primary": 1}]}' 
     https://example.com/api/v1/products

PHP Example

$data = [
    'name'        => 'Premium Backpack',
    'price'       => 79.99,
    'stock_level' => 50,
    'status'      => 1,
    'categories'  => [['cat_id' => 5, 'primary' => 1]],
];

$ch = curl_init('https://example.com/api/v1/products');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer KEY:SECRET', 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode($data),
    CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
echo "Created product #{$result['data']['product_id']}
";

Response (201 Created)

{"success": true, "data": {"product_id": 58, "name": "Premium Backpack", "price": 79.99}}