Authorization
Required roles: admin, gestor
Request Body
Stock Keeping Unit - must be unique across all products
Detailed description of the product
Product category (e.g., “Electronics”, “Food”, “Clothing”)
Unit of measurement (e.g., “kg”, “liters”, “units”, “boxes”)
Value per unit for fractional quantities
Whether the product has an expiration date
Expiration date for perishable products (ISO format or string)
Recommended selling price for the product
Response
Generated UUID for the product
Expiration date if applicable
Recommended selling price
Example Request
curl -X POST https://api.example.com/api/v1/products/ \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"sku": "PROD-001",
"name": "Organic Apples",
"description": "Fresh organic apples from local farms",
"category": "Fruits",
"unit_measure": "kg",
"unit_value": 1.0,
"is_perishable": true,
"expiration_date": "2026-03-15",
"suggested_price": 4.99
}'
Example Response
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"sku": "PROD-001",
"name": "Organic Apples",
"category": "Fruits",
"unit_measure": "kg",
"unit_value": 1.0,
"is_perishable": true,
"expiration_date": "2026-03-15",
"suggested_price": 4.99
}
Error Responses
Error message describing what went wrong
400 Bad Request
Returned when required fields are missing:
{
"error": "Missing required fields"
}
401 Unauthorized
Returned when authentication token is invalid or missing.
403 Forbidden
Returned when the authenticated user lacks required role (admin or gestor).