Skip to main content

Top Selling Products

Get the top 10 best-selling products based on total quantity sold.

Endpoint

GET /venta/productos-mas-vendidos

Response

Returns an array of products ranked by quantity sold.
productoId
long
Product ID
nombreProducto
string
Product name
cantidadVendida
double
Total quantity sold across all sales
curl https://api.example.com/venta/productos-mas-vendidos
[
  {
    "productoId": 456,
    "nombreProducto": "Mouse Inalámbrico",
    "cantidadVendida": 250.0
  },
  {
    "productoId": 789,
    "nombreProducto": "Teclado USB",
    "cantidadVendida": 180.0
  },
  {
    "productoId": 123,
    "nombreProducto": "Monitor LED 24\"",
    "cantidadVendida": 95.0
  },
  {
    "productoId": 234,
    "nombreProducto": "Auriculares Bluetooth",
    "cantidadVendida": 87.0
  },
  {
    "productoId": 567,
    "nombreProducto": "Webcam HD",
    "cantidadVendida": 72.0
  }
]

Sales by Month

Get sales totals grouped by month.

Endpoint

GET /venta/ventas-por-mes

Response

Returns monthly sales aggregation with total revenue per month.
mes
string
Month identifier (format determined by backend implementation)
total
double
Total sales amount for the month
curl https://api.example.com/venta/ventas-por-mes
[
  {
    "mes": "2026-01",
    "total": 45000.0
  },
  {
    "mes": "2026-02",
    "total": 52000.0
  },
  {
    "mes": "2026-03",
    "total": 38000.0
  },
  {
    "mes": "2026-04",
    "total": 61000.0
  },
  {
    "mes": "2026-05",
    "total": 55000.0
  }
]

Total Sales Revenue

Get the total revenue from all sales.

Endpoint

GET /venta/total-ventas

Response

Returns a single numeric value representing the sum of all sale totals.
value
double
Total sales revenue across all transactions
curl https://api.example.com/venta/total-ventas
250000.0

Use Cases

Inventory Management

Use the top-selling products endpoint to:
  • Identify fast-moving inventory
  • Plan restocking schedules
  • Optimize warehouse space allocation
  • Forecast demand for popular items

Financial Reporting

Use the monthly sales and total revenue endpoints to:
  • Generate monthly performance reports
  • Track revenue trends over time
  • Calculate year-over-year growth
  • Prepare financial statements

Business Intelligence

Combine these analytics endpoints to:
  • Identify seasonal sales patterns
  • Analyze product performance
  • Make data-driven purchasing decisions
  • Set sales targets and KPIs

Notes

  • The top products endpoint returns a maximum of 10 products
  • Sales totals include IGV (18% tax)
  • Monthly aggregation uses the fechaVenta field from sale records
  • All monetary values are in the system’s base currency

Build docs developers (and LLMs) love