# Get Aggregated Sales

**GET /f/finance/{businessLocationId}/aggregatedSales**

Get sales for the current business day or the specified date range, aggregated by one or more values.
The values are specified in the `groupBy` parameter and are nested in the order provided in the request.

- Use either the `date` parameter **or** the `from` and `to` parameters to specify the period.
- The `date` parameter specifies a single date for aggregation.
- The `from` and `to` parameters specify a date-time range and must be used together.
- **If neither `date` nor `from`/`to` are provided it defaults to today's date**.
- The date range between `from` and `to` cannot exceed 365 days (1 year).



## Servers
- Demo URL: https://api.trial.lsk.lightspeed.app (Demo URL)
- Production URL: https://api.lsk.lightspeed.app (Production URL)


## Authentication methods
- O auth2


## Parameters

### Path parameters

- **businessLocationId** (integer(int64))
  The unique identifier for the business location.


### Query parameters

- **date** (string(date))
  Specify a single date for which to retrieve aggregated sales data. Cannot be combined with `from` and `to`. Use either `date`, or both `from` and `to`.

- **from** (string(date-time))
  Specify the start datetime for the aggregation range. Must be used together with `to`. Cannot be combined with `date`.

- **to** (string(date-time))
  Specify the end datetime for the aggregation range. Must be used together with `from`. Cannot be combined with `date`.

- **flattened** (boolean)

- **groupBy** (string)
  Comma-separated list of parameters to group the results by.
  The allowed values are: `staff`, `device`, `deviceId`, `tag`, `accountingGroup`, and `statisticGroup`.
  For example, `groupBy` can be set to `staff,device`.



## Responses
### 200
Aggregated sales returned

#### Body: application/json (object)
- **groupByKey** (string)
  The groupBy parameter provided.

- **groupByValue** (string)
  The value that corresponds to the groupBy parameter.

- **totalAmount** (string)
  The aggregated total of sales for this data set (ex. `staff: manager`).

- **serviceCharge** (string)
  The aggregated total of service charges for this data set (ex. `staff: manager`).

- **totalDiscountedAmount** (string)
  The aggregated total of discounts for this data set (ex. `staff: manager`).

- **totalTaxAmount** (string)
  The aggregated tax total for this data set (ex. `staff: manager`).

- **numberOfSales** (number)
  The total number of sale lines for this data set (ex. `staff: manager`).

- **children** (array[object])

- **nextStartOfDayAsIso8601** (string)

- **dataComplete** (boolean)

- **businessName** (string)


### 400
Bad Request

#### Body: */* (object)
- ***** (object)



[Powered by Bump.sh](https://bump.sh)
