Skip to main content
POST
Create Product

Endpoint

Authentication

Admin access required. Only users with the ADMIN role can create products.

Request Headers

Request Body

This endpoint accepts multipart/form-data to support image upload.
string
required
Product name (minimum 3 characters)
string
required
Product description (minimum 10 characters)
number
required
Product price (must be positive)
number
Original price (for displaying discounts)
number
required
Initial stock quantity (must be non-negative integer)
number
required
Category ID to associate with this product
number
Brand ID to associate with this product
number
default:"0.5"
Product weight in kg
number
default:"10"
Product height in cm
number
default:"10"
Product width in cm
number
default:"10"
Product depth in cm
Whether this product should be featured
file
Product image file (uploaded as multipart form data)

Response

boolean
Indicates if the product was created successfully
object
The newly created product object
number
Unique product identifier
string
Product name
string
Product description
decimal
Product price
decimal
Original price
number
Stock quantity
string
Uploaded product image URL
Featured status
decimal
Weight in kg
number
Height in cm
number
Width in cm
number
Depth in cm
number
Category ID
number
Brand ID
datetime
Creation timestamp
datetime
Last update timestamp

Example Request

Example Response

Error Responses

Validation Error

Unauthorized

Server Error