Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/ecommerce-delivery/llms.txt

Use this file to discover all available pages before exploring further.

The list endpoint returns a paginated slice of the full product catalog, sorted newest-first. It is accessible without authentication, making it suitable for public-facing storefronts. When called with a valid token the request is processed identically — the TokenOptional middleware simply attaches user context when a token is present, without blocking unauthenticated requests. Pagination is controlled via path parameters. If pag and perpage are omitted, the server defaults to page 1 with 10 items per page.

POST /api/product/list-product/:pag?/:perpage?

Auth: Optional (token accepted but not required)

Path parameters

pag
number
Page number to retrieve. Defaults to 1 when omitted. Pages are 1-indexed — passing 1 returns the first page.
perpage
number
Number of products per page. Defaults to 10 when omitted.

Responses

msj
string
"Cargando productos..." on success.
status
boolean
true on success.
data
array
Array of product objects for the requested page, sorted by _id descending (newest first).
pagination
object
Pagination metadata for the current response.

Error responses

StatusCause
500Unexpected server error.

Example

# Fetch the first page with 10 products (default)
curl -X POST https://your-domain.com/api/product/list-product

# Fetch page 2 with 5 products per page
curl -X POST https://your-domain.com/api/product/list-product/2/5

# Authenticated request (token optional — same response shape)
curl -X POST https://your-domain.com/api/product/list-product/1/20 \
  -H "Authorization: Bearer <token>"
Success response (200):
{
  "msj": "Cargando productos...",
  "status": true,
  "data": [
    {
      "_id": "664a1f2e8b3c4d001e2f3a4b",
      "userId": "663f0e1d7a2b3c000d1e2f3a",
      "title": "Classic Logo Tee",
      "description": "Comfortable everyday crew-neck t-shirt.",
      "price": 29.99,
      "minCant": 50,
      "discount": "Sin descuento",
      "priceDiscount": "",
      "colorsSize": [
        { "label": "Blanco", "value": "1" },
        { "label": "Negro", "value": "2" }
      ],
      "sizes": [
        { "label": "S", "value": "2" },
        { "label": "M", "value": "3" },
        { "label": "L", "value": "4" }
      ],
      "typeShirt": "Regular Fit",
      "productImg": ["storage/product/12image1.jpg"],
      "points": {
        "cant": 5,
        "users": ["663f0e1d7a2b3c000d1e2f3b"]
      },
      "createdAt": "2024-05-20T14:32:00.000Z",
      "updatedAt": "2024-05-20T14:32:00.000Z"
    }
  ],
  "pagination": {
    "pag": "2",
    "perpage": 5,
    "pags": 8
  }
}

Build docs developers (and LLMs) love