> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keebai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GET /v1/ecommerce/sales/summary

> What sold in a period: services, products and other charges, day by day, best sellers, weekly trend, weekdays and payment methods.

Returns the same report as **Ventas › Summary** in the portal, for one period. It is built for analysis: one call answers what was sold, when, and how it was paid.

Every amount is the **net sale** — the total charged minus the tip — of completed sales. A sale's net is spread over its lines by subtotal, so sale-level discounts land on the lines they cover and the three kinds add up exactly to the period's net sales.

## Endpoint

```
GET https://api.keebai.com/v1/ecommerce/sales/summary
```

## Required scope

`ecommerce:sales:read`

## Headers

| Header | Required | Value |
| - | - | - |
| `Authorization` | Yes | `Bearer kbai_pk_<token>` |

## Query parameters

| Field | Type | Required | Description |
| - | - | - | - |
| `from` | `string` | Yes | First day of the period, `YYYY-MM-DD`. |
| `to` | `string` | Yes | Last day of the period, inclusive, `YYYY-MM-DD`. |
| `branch_id` | `string` | No | One branch `ObjectId`, or several separated by commas. Without it, every branch and online store. |
| `timezone` | `string` | No | IANA time zone the days are cut in, e.g. `America/Santiago`. |

## Example request

```bash curl theme={"system"}
curl -G https://api.keebai.com/v1/ecommerce/sales/summary \
  -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  --data-urlencode "from=2026-11-01" \
  --data-urlencode "to=2026-11-30" \
  --data-urlencode "timezone=America/Santiago"
```

```js JavaScript theme={"system"}
const params = new URLSearchParams({
  from: "2026-11-01",
  to: "2026-11-30",
  timezone: "America/Santiago",
});

const response = await fetch(
  `https://api.keebai.com/v1/ecommerce/sales/summary?${params}`,
  { headers: { Authorization: `Bearer ${process.env.KEEBAI_API_TOKEN}` } },
);
const summary = await response.json();
```

```python Python theme={"system"}
import os, requests

resp = requests.get(
    "https://api.keebai.com/v1/ecommerce/sales/summary",
    headers={"Authorization": f"Bearer {os.environ['KEEBAI_API_TOKEN']}"},
    params={"from": "2026-11-01", "to": "2026-11-30", "timezone": "America/Santiago"},
    timeout=10,
)
resp.raise_for_status()
summary = resp.json()
```

## Response

### 200 OK

```json theme={"system"}
{
  "from": "2026-11-01",
  "to": "2026-11-30",
  "previous": { "from": "2026-10-01", "to": "2026-10-30" },
  "kinds": [
    { "kind": "service", "amount": 5720364, "quantity": 486, "sales": 471, "previous_amount": 5209800 },
    { "kind": "product", "amount": 2271321, "quantity": 211, "sales": 160, "previous_amount": 1872400 },
    { "kind": "custom", "amount": 420615, "quantity": 38, "sales": 36, "previous_amount": 438600 }
  ],
  "daily": [
    { "date": "2026-11-01", "service": 0, "product": 0, "custom": 0 },
    { "date": "2026-11-02", "service": 192000, "product": 64500, "custom": 12000 }
  ],
  "top": {
    "service": {
      "items": [{ "key": "svc-cut", "name": "Corte clásico", "quantity": 212, "amount": 2120000 }],
      "rest": { "count": 9, "quantity": 51, "amount": 412000 }
    },
    "product": { "items": [], "rest": { "count": 0, "quantity": 0, "amount": 0 } },
    "custom": { "items": [], "rest": { "count": 0, "quantity": 0, "amount": 0 } }
  },
  "weeks": [
    { "from": "2026-11-23", "to": "2026-11-29", "service": 1890000, "product": 760000, "custom": 140000 }
  ],
  "weekdays": [
    { "weekday": 1, "average": 392000, "days": 4 }
  ],
  "payments": [
    { "method": "debit", "amount": 3870000 },
    { "method": "credit", "amount": 2610000 }
  ],
  "channels": { "branch": 7660000, "store": 757000 }
}
```

| Field | Description |
| - | - |
| `previous` | The period `kinds[].previous_amount` compares with: the same days of the previous month when `from` is the 1st, otherwise the window of the same length right before. |
| `kinds` | One row per kind of line: `service`, `product`, and `custom` (charges outside the catalog). `sales` counts the sales that include that kind. |
| `daily` | Every day of the period, by kind, including days with no sales. |
| `top` | The five best sellers of each kind by amount, grouped by product or catalog item; `rest` sums the others. |
| `weeks` | The last eight weeks, Monday to Sunday, ending with the week of `to` (cut at `to`). |
| `weekdays` | Average net sale per weekday (`0` = Sunday) over the days of the period already lived; `days` is how many there were. |
| `payments` | What was charged per payment method code, tips included. |
| `channels` | Net sales at a branch (`branch`) and in online stores (`store`). |

### 400 Bad Request

A missing or malformed `from` / `to`, `from` after `to`, a malformed `branch_id`, or an unknown time zone.

### 401 Unauthorized

Missing, invalid, revoked, or expired token.

### 403 Forbidden

The token does not have the `ecommerce:sales:read` scope.

### 502 Bad Gateway

`ECOMMERCE_UPSTREAM_ERROR` — the ecommerce service could not answer.

## Operational notes

* **Amounts are integers in the currency's minor unit.** Kinds are rounded one by one, so their sum can differ from the net sales by a unit.
* **Cancelled, internal and report-excluded sales are left out**, the same rule as the portal's sales reports.
* **Payment methods are codes** (`cash`, `debit`, a tenant's own method code…). They include the tip, so they add up to the total charged, not to the net.
* **For the list of the sales behind these figures** use [`GET /v1/ecommerce/sales`](https://docs.keebai.com/dev/endpoints/ecommerce-sales-list) with the same dates.


## OpenAPI

````yaml GET /v1/ecommerce/sales/summary
openapi: 3.0.0
info:
  title: Keebai Public API
  description: Superficie pública REST autenticada con Personal Access Tokens (PAT).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.keebai.com
    description: Production
security: []
tags: []
paths:
  /v1/ecommerce/sales/summary:
    get:
      tags:
        - ecommerce
      summary: Resumen de ventas de un período
      description: >-
        Lo vendido por tipo (servicios, productos y otros cobros) con el período
        anterior, día a día, los más vendidos de cada tipo, las últimas 8
        semanas, el promedio por día de la semana, los medios de pago y el canal
        (presencial u online). Los montos son la venta neta (total menos
        propina) repartida entre las líneas, así que los tipos suman la venta
        neta del período.
      operationId: PublicEcommerceController_salesSummary
      parameters:
        - name: from
          required: true
          in: query
          description: Primer día del período (YYYY-MM-DD)
          schema:
            example: '2026-11-01'
            type: string
        - name: to
          required: true
          in: query
          description: Último día del período, inclusive (YYYY-MM-DD)
          schema:
            example: '2026-11-30'
            type: string
        - name: branch_id
          required: false
          in: query
          description: Sucursal, o varias separadas por coma. Sin ella, todas
          schema:
            type: string
        - name: timezone
          required: false
          in: query
          description: Zona horaria IANA con la que se cortan los días
          schema:
            type: string
            example: America/Santiago
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicSalesSummaryResponseDto'
      security:
        - PAT: []
components:
  schemas:
    PublicSalesSummaryResponseDto:
      type: object
      properties:
        from:
          type: string
        to:
          type: string
        previous:
          $ref: '#/components/schemas/SalesSummaryRangeDto'
        kinds:
          type: array
          items:
            $ref: '#/components/schemas/SalesSummaryKindDto'
        daily:
          type: array
          items:
            $ref: '#/components/schemas/SalesSummaryDayDto'
        top:
          $ref: '#/components/schemas/SalesSummaryTopByKindDto'
        weeks:
          description: Últimas 8 semanas, de lunes a domingo
          type: array
          items:
            $ref: '#/components/schemas/SalesSummaryWeekDto'
        weekdays:
          type: array
          items:
            $ref: '#/components/schemas/SalesSummaryWeekdayDto'
        payments:
          type: array
          items:
            $ref: '#/components/schemas/SalesSummaryPaymentDto'
        channels:
          $ref: '#/components/schemas/SalesSummaryChannelsDto'
      required:
        - from
        - to
        - previous
        - kinds
        - daily
        - top
        - weeks
        - weekdays
        - payments
        - channels
    SalesSummaryRangeDto:
      type: object
      properties:
        from:
          type: string
        to:
          type: string
      required:
        - from
        - to
    SalesSummaryKindDto:
      type: object
      properties:
        kind:
          type: string
          enum:
            - service
            - product
            - custom
        amount:
          type: number
          description: Venta neta (total menos propina) de ese tipo
        quantity:
          type: number
          description: Unidades vendidas
        sales:
          type: number
          description: Ventas que incluyen ese tipo
        previous_amount:
          type: number
          description: Venta neta del período anterior
      required:
        - kind
        - amount
        - quantity
        - sales
        - previous_amount
    SalesSummaryDayDto:
      type: object
      properties:
        date:
          type: string
        service:
          type: number
        product:
          type: number
        custom:
          type: number
      required:
        - date
        - service
        - product
        - custom
    SalesSummaryTopByKindDto:
      type: object
      properties:
        service:
          $ref: '#/components/schemas/SalesSummaryTopDto'
        product:
          $ref: '#/components/schemas/SalesSummaryTopDto'
        custom:
          $ref: '#/components/schemas/SalesSummaryTopDto'
      required:
        - service
        - product
        - custom
    SalesSummaryWeekDto:
      type: object
      properties:
        from:
          type: string
        to:
          type: string
        service:
          type: number
        product:
          type: number
        custom:
          type: number
      required:
        - from
        - to
        - service
        - product
        - custom
    SalesSummaryWeekdayDto:
      type: object
      properties:
        weekday:
          type: number
          description: 0 = domingo … 6 = sábado
        average:
          type: number
          description: Venta promedio de ese día
        days:
          type: number
          description: Días de ese tipo ya vividos en el período
      required:
        - weekday
        - average
        - days
    SalesSummaryPaymentDto:
      type: object
      properties:
        method:
          type: string
          description: Código del medio de pago
        amount:
          type: number
      required:
        - method
        - amount
    SalesSummaryChannelsDto:
      type: object
      properties:
        branch:
          type: number
          description: Ventas presenciales (sucursal)
        store:
          type: number
          description: Ventas de tiendas online
      required:
        - branch
        - store
    SalesSummaryTopDto:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/SalesSummaryItemDto'
        rest:
          $ref: '#/components/schemas/SalesSummaryRestDto'
      required:
        - items
        - rest
    SalesSummaryItemDto:
      type: object
      properties:
        key:
          type: string
          description: Producto o ítem del catálogo
        name:
          type: string
        quantity:
          type: number
        amount:
          type: number
      required:
        - key
        - name
        - quantity
        - amount
    SalesSummaryRestDto:
      type: object
      properties:
        count:
          type: number
        quantity:
          type: number
        amount:
          type: number
      required:
        - count
        - quantity
        - amount
  securitySchemes:
    PAT:
      scheme: bearer
      bearerFormat: kbai_pk_<hex>
      type: http
      description: >-
        Personal Access Token con prefijo `kbai_pk_`. Generar desde el portal
        con permiso `developer.manage_tokens`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.