The product creation endpoint lets authenticated administrators add new shirts to the catalog. Because it accepts image uploads alongside text fields, every request must be sent asDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/Ecommerce/llms.txt
Use this file to discover all available pages before exploring further.
multipart/form-data. Uploaded images are automatically resized via Sharp and stored in Google Cloud Storage as WebP files before the product document is persisted to the database.
Endpoint
| Property | Value |
|---|---|
| Method | POST |
| Path | /api/product/agregate |
| Auth | token-access: <jwt-token> — Admin role required (name: "Admin", value: "2") |
| Content-Type | multipart/form-data |
Only users whose role satisfies
roles.some(r => r.name === "Admin" && r.value === "2") can create products. Requests from non-admin tokens receive a 203 response.Request Fields
Text fields
Display name of the product (e.g.
"Classic Oxford Shirt"). Shown in catalog listings and search results.Full-length product description including material, fit notes, and care instructions.
Available sizes for this product. Each element must be one of the accepted enum values.Allowed values:
"XS" "S" "M" "L" "XL" "XXL"When submitting via multipart/form-data, repeat the field key for each size:Base retail price in the store’s currency unit (e.g.
49.99). Used as the reference value when calculating discounted prices later via the update endpoint.Initial stock quantity. Defaults to
0 when omitted. Tracks the minimum available inventory count for the listing.Image file fields
All four image slots are optional but recommended for a complete listing. Each field accepts a single file upload. Images are processed by Sharp on the server before being uploaded to GCS — you do not need to resize locally.Principal image — the primary hero shot displayed on the product detail page.
Processed to 1500 × 2000 px WebP.
Thumbnail image — used in catalog grid cards and search results.
Processed to 500 × 666 px WebP.
Detail / zoom image — high-resolution version for the image zoom viewer.
Processed to 2000 × 2667 px WebP.
Square catalog image — used in square-format promotional grids and social previews.
Processed to 1080 × 1080 px WebP.
Image Processing
Uploaded files go through the following pipeline before the product is saved:Receive multipart upload
Multer accepts up to one file per field (
imageUrlIp, imageUrlMn, imageUrlIdz, imageUrlIc) held in memory.Resize with Sharp
Each buffer is resized to its target dimensions and converted to WebP format for optimal compression.
Store in GCS
The WebP buffer is written to a Google Cloud Storage bucket. The resulting public URL is stored in the corresponding array field on the product document.
Response
Success — 200 OK
Human-readable confirmation. Value:
"Producto creado correctamente".Always
true on a successful creation.The newly created product document.
Error responses
| Status | Meaning |
|---|---|
200 | Missing required fields (title, description, sizes, price) — status: false, uses message key. |
203 | Authenticated user does not have the Admin role — status: false, uses msj key. |
500 | Internal server error (e.g. GCS upload failure, database error). |
The missing-fields check returns HTTP
200 (not 400 or 422) with status: false and a message field. The no-admin response returns 203 with a msj field — note the different key names.