Products
Create a product
Creates a product with the same rules as the dashboard (plan limits included). Send multipart/form-data to upload images, or JSON without them and add images later.
POST
https://elmatajer.com/api/v1/vendor/productsPermission:
products.writeRequest body
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Product name (Arabic or your main language). |
price | number | Yes | Selling price. |
category_ids | integer[] | Yes | At least one category id (List categories). |
name_en, description, description_en | string | No | English name and descriptions (HTML allowed). |
compare_price | number | No | The crossed-out price. |
sku | string | No | Your code — used by Update stock by SKU. |
manage_stock, stock_qty, low_qty | bool / integer | No | Track stock and its quantity. |
variants[] | object[] | No | color, size, price, qty, sku, compare_price per combination.
|
images[] | file[] | No | Up to 10 images (jpg, png, webp, 4 MB each) — multipart only. |
is_available | bool | No | Shown in the store (default true). |
slug, meta_title, meta_description | string | No | SEO fields. |
Request
curl -X POST "https://elmatajer.com/api/v1/vendor/products" \
-H "Api-Key: YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"name":"Cotton T-shirt","name_en":"Cotton T-shirt","price":299,"compare_price":349,"sku":"TS-001","category_ids":[74],"manage_stock":true,"stock_qty":40,"variants":[{"color":"Black","size":"L","price":299,"qty":10,"sku":"TS-001-BL-L"},{"color":"Black","size":"XL","price":299,"qty":8,"sku":"TS-001-BL-XL"}]}'
const res = await fetch("https://elmatajer.com/api/v1/vendor/products", {
method: "POST",
headers: {
"Api-Key": process.env.ELMATAJER_API_KEY,
"Accept": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "Cotton T-shirt",
"name_en": "Cotton T-shirt",
"price": 299,
"compare_price": 349,
"sku": "TS-001",
"category_ids": [
74
],
"manage_stock": true,
"stock_qty": 40,
"variants": [
{
"color": "Black",
"size": "L",
"price": 299,
"qty": 10,
"sku": "TS-001-BL-L"
},
{
"color": "Black",
"size": "XL",
"price": 299,
"qty": 8,
"sku": "TS-001-BL-XL"
}
]
})
});
const data = await res.json();
$ch = curl_init("https://elmatajer.com/api/v1/vendor/products");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Api-Key: " . getenv('ELMATAJER_API_KEY'), "Accept: application/json", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Cotton T-shirt',
'name_en' => 'Cotton T-shirt',
'price' => 299,
'compare_price' => 349,
'sku' => 'TS-001',
'category_ids' => [
74
],
'manage_stock' => true,
'stock_qty' => 40,
'variants' => [
[
'color' => 'Black',
'size' => 'L',
'price' => 299,
'qty' => 10,
'sku' => 'TS-001-BL-L'
],
[
'color' => 'Black',
'size' => 'XL',
'price' => 299,
'qty' => 8,
'sku' => 'TS-001-BL-XL'
]
]
]),
]);
$data = json_decode(curl_exec($ch), true);
Response 200
{
"status": "ok",
"data": {
"id": 22511,
"name": "مجموعة مكعبات بناء",
"name_en": "Building blocks set",
"slug": "building-blocks-set",
"sku": "BLK-01",
"image": "https://cdn.elmatajer.com/…/blocks.webp",
"images": [
{
"id": 81,
"url": "https://cdn.elmatajer.com/…/blocks.webp"
}
],
"price": 120,
"original_price": 132,
"discount_pct": 9,
"stock": {
"state": "in",
"qty": 31,
"tracked": true,
"low": 5
},
"category_ids": [
74
],
"is_available": true,
"is_draft": false,
"has_variants": false,
"variants": [],
"url": "https://your-store.elmatajer.com/detail-building-blocks-set",
"created_at": "2026-10-01T10:00:00+03:00"
}
}