Skip to main content

Documentation 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.

The order history API exposes two complementary views of the same cart data. Buyers can retrieve a paginated list of every cart they have created — each document shows exactly what was ordered, at what price, and when. Sellers can retrieve a paginated list of all carts that contain at least one product they listed, giving them a complete picture of their sales activity without requiring a separate orders collection. Both endpoints require a valid JWT token and share the same pagination interface.

Buyer: list purchase history

POST /api/carts/list-my-buy/:pag?/:perpage? Returns all cart documents where cart.user._id matches the authenticated user’s _id. Results are sorted by most recently created first (_id descending) and are split into pages.

Headers

token-access
string
required
A valid JWT token. Format: <jwt-token>

Path parameters (optional)

pag
number
The page number to retrieve. Defaults to 1 if omitted.
perpage
number
The number of cart documents per page. Defaults to 10 if omitted.

Response

msj
string
"Cargando mis compras" on success.
status
boolean
true on success.
data
array
Array of cart documents belonging to the authenticated buyer.
pagination
object
Pagination metadata for the result set.

Error response

A 203 is returned with { msj: "Error al cargar mis compras", status: false } if the database query fails.

Example

curl -X POST https://api.example.com/api/carts/list-my-buy \
  -H "token-access: <jwt-token>"

Seller: list sales orders

This endpoint queries on the products[].user._id field — not the top-level cart.user._id. A cart appears in a seller’s sales list if any of its product lines were listed by that seller, even if the cart also contains products from other sellers.
POST /api/carts/list-my-sale/:pag?/:perpage? Returns all cart documents that contain at least one product whose user._id (the seller) matches the authenticated user’s _id. Results are sorted by most recently created first and are paginated using the same interface as the buyer endpoint.

Headers

token-access
string
required
A valid JWT token. Format: <jwt-token>

Path parameters (optional)

pag
number
The page number to retrieve. Defaults to 1 if omitted.
perpage
number
The number of cart documents per page. Defaults to 10 if omitted.

Response

The response shape is identical to the buyer history endpoint.
msj
string
"Cargando mis ventas" on success.
status
boolean
true on success.
data
array
Array of cart documents that contain at least one product listed by the authenticated seller. Each cart document has the same shape described in the buyer history response above, including full buyer info and all product lines.
pagination
object
Pagination metadata.

Error response

A 203 is returned with { msj: "Error al cagar mis ventas", status: false } if the database query fails.

Example

curl -X POST https://api.example.com/api/carts/list-my-sale \
  -H "token-access: <jwt-token>"

Build docs developers (and LLMs) love