Create Product
POST /api/v1/products
Required Fields
| Field | Type | Description |
name | string | Product name |
price | float | Product price |
Optional Fields
| Field | Type | Description |
description | string | Full HTML description |
product_code | string | SKU (auto-generated if empty) |
sale_price | float | Sale price (0 = no sale) |
stock_level | int | Quantity in stock |
product_weight | float | Weight for shipping |
tax_type | int | Tax class ID |
tax_inclusive | int | 1 = price includes tax |
status | int | 1 = active, 0 = disabled |
categories | array | Category 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}}