---
title: "reports__getSalesByClientTotals"
method: GET
path: "/tools/reports__getSalesByClientTotals"
tags: ["Reports"]
---

# reports__getSalesByClientTotals

`GET /tools/reports__getSalesByClientTotals`

Obtiene el total/suma de compras/transacciones por cliente. Retorna un resumen agregado con subTotal, total, totalDiscount

## Request body

- object
  - `from` string, date, required — Fecha inicio (YYYY-MM-DD)
  - `to` string, date, required — Fecha fin (YYYY-MM-DD)
  - `optionalParams` object, nullable — Opcional. Envía un objeto (no un texto con JSON escapado).<br>• clientName — si lo indicas, el resumen es solo de ese cliente; si no, de todos<br>• order_field y order_direction — para ordenar antes de consolidar (totalDocuments, subTotal, total + ASC o DESC)
    - `clientName` string — Filtrar por cliente; si se omite, totales de todos los clientes.
    - `order_direction` 'ASC' | 'DESC' — Dirección de orden (junto con order_field).
    - `order_field` 'totalDocuments' | 'subTotal' | 'total' — Campo de orden (totalDocuments, subTotal, total).

## Response `200`

Totales agregados de compras por cliente

## Other responses

- `401` — No autorizado

---

[API](https://skmtc.net/alegra/apis/ingresos.md) · [All operations](https://skmtc.net/alegra/apis/ingresos/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/alegra/ingresos/revisions/cd52d3f68f1b/schema)
