# Get sales grouped by one dimension (/api-reference/sales/getSalesBreakdown)

## GET https://api.ajour.dk/v1/sales/breakdown

One endpoint for every dashboard chart and report table. `groupBy` picks the dimension. Rows are sorted by turnover, highest first. Time groupings (`hour`, `weekday`, `day`, `month`) are sorted by time instead. `hour` only returns the company's work hours, like the dashboard. `productGroup` and `product` leave out discount lines, like the dashboard. The period can be at most 366 days. Requires scope `sales:read`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `groupBy` | query | `productGroup`, `product`, `location`, `salesperson`, `hour`, `weekday`, `day`, `month` | yes | The dimension to group by. |
| `from` | query | string (date) | yes | First day of the period, as a local date in Europe/Copenhagen. |
| `to` | query | string (date) | yes | Last day of the period, included. Local date in Europe/Copenhagen. |
| `locationId` | query | array of integer (int32) | no | Only these locations. Repeat the parameter for more than one. Must be locations the key can see. Leave out for all of them. |
| `productGroupId` | query | string | no | Only this product group (POS number). |
| `productId` | query | array of string | no | Only these products (POS numbers). Repeat the parameter for more than one. |
| `orderType` | query | array of `pos`, `online`, `invoice` | no | Only these order types. Repeat the parameter for more than one. |
| `salesperson` | query | string | no | Only this salesperson, by name as on the register. |
| `vat` | query | `include`, `exclude` | no | Show money amounts including or excluding VAT. |
| `limit` | query | integer (int32) | no | Return only the top N rows, for example the 10 most popular products. |
| `compare` | query | `previousYear` | no | Add last year's values per row. |

### Responses

- `200`: OK
- `400`: A parameter has the wrong format, or an unknown value.
- `401`: The API key is missing, wrong or revoked.
- `403`: The key is valid but does not have the scope this call needs, or the company is not active.
- `404`: The item does not exist, or it is a location the key cannot see.
- `422`: The parameters have the right format but are not allowed together.
- `429`: Too many requests for this key. Wait for `Retry-After` seconds.

Example `200` response:

```json
{
  "groupBy": "productGroup",
  "period": {
    "from": "2026-11-01",
    "to": "2026-11-21"
  },
  "currency": "DKK",
  "vat": "include",
  "rows": [
    {
      "key": "10",
      "label": "Kaffe",
      "quantity": 7410,
      "turnover": 288340,
      "share": 59.3,
      "previousYear": null
    },
    {
      "key": "20",
      "label": "Kage",
      "quantity": 3122,
      "turnover": 121050,
      "share": 24.9,
      "previousYear": null
    }
  ],
  "total": {
    "quantity": 12880,
    "turnover": 486210.5
  },
  "previousYear": null
}
```