Back

    Buyamia Directory API

    v1.0

    Create Product

    POST
    /v1/products

    Create a new product in a supplier's catalog.

    products.write

    Requires the products.write permission scope.

    Request Body

    FieldTypeRequiredDescription
    business_iduuidYesThe supplier business UUID that owns this product
    namestringYesProduct name
    descriptionstringNoProduct description
    base_pricenumberNoBase unit price
    currencystringNoCurrency code (default: IDR)
    unit_of_measurestringNoUnit (default: piece). Options: piece, kg, meter, liter, set, box, roll, sheet
    skustringNoSKU / part number
    category_iduuidNoProduct category ID
    imagesstring[]NoArray of image URLs
    is_availablebooleanNoAvailability flag (default: true)
    specificationsobjectNoKey-value pairs for product specs (e.g. {"material": "Teak", "dimensions": "120x60cm"})
    moqintegerNoMinimum order quantity

    Behavior

    • Validates that the business_id exists in the directory
    • Auto-generates a URL-friendly slug from the product name
    • Sets initial status to "active"
    • Fires product.created webhook 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