Create Product
POST
/v1/productsCreate a new product in a supplier's catalog.
products.write
Requires the products.write permission scope.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
business_id | uuid | Yes | The supplier business UUID that owns this product |
name | string | Yes | Product name |
description | string | No | Product description |
base_price | number | No | Base unit price |
currency | string | No | Currency code (default: IDR) |
unit_of_measure | string | No | Unit (default: piece). Options: piece, kg, meter, liter, set, box, roll, sheet |
sku | string | No | SKU / part number |
category_id | uuid | No | Product category ID |
images | string[] | No | Array of image URLs |
is_available | boolean | No | Availability flag (default: true) |
specifications | object | No | Key-value pairs for product specs (e.g. {"material": "Teak", "dimensions": "120x60cm"}) |
moq | integer | No | Minimum order quantity |
Behavior
- Validates that the
business_idexists in the directory - Auto-generates a URL-friendly
slugfrom the product name - Sets initial
statusto"active" - Fires
product.createdwebhook event
Example Request
cURLbash
curl -X POST "https://rjpxllsycikfabazvkdh.supabase.co/functions/v1/directory-api/v1/products" \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"business_id": "biz-uuid-here",
"name": "Executive Standing Desk",
"description": "Height-adjustable mahogany standing desk, 180x80cm",
"base_price": 5500000,
"currency": "IDR",
"unit_of_measure": "piece",
"sku": "FJ-DESK-001",
"moq": 10,
"specifications": {
"material": "Mahogany",
"dimensions": "180x80x75cm",
"weight": "45kg"
},
"images": ["https://example.com/desk-front.jpg"]
}'Response (201 Created)
{
"data": {
"id": "prod-uuid",
"business_id": "biz-uuid-here",
"name": "Executive Standing Desk",
"slug": "executive-standing-desk",
"base_price": 5500000,
"currency": "IDR",
"status": "active",
"is_available": true,
"created_at": "2026-03-15T08:00:00Z"
}
}Last updated on March 15, 2026