# Download a report as PDF or Excel (/api-reference/reports/getReport)

## GET https://api.ajour.dk/v1/reports/{reportType}

Builds the report and returns the file: the same PDF or Excel file as in the Ajour back office. Choose the format with `format` or the `Accept` header. A report covers one location or all the key's locations, so a key limited to several locations must pass one `locationId`. Large periods can take up to 90 seconds. Requires scope `reports:read`. `sales-per-client` and `client-card-balances` also need `customers:read`. At most 10 report files per minute per key.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `reportType` | path | `total-sales`, `total-sales-per-date`, `total-sales-per-product-group`, `sales-per-date-and-time`, `sales-per-date-time-and-product`, `sales-per-salesperson`, `sales-per-salesperson-avg-sales-per-expedition`, `sales-returns-per-salesperson`, `turnover-per-guest`, `logbook-per-salesperson`, `sales-per-client`, `client-card-balances` | yes | The report to build. See `GET /reports` for the list. |
| `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. |
| `format` | query | `pdf`, `xlsx` | no | File format: `pdf` (default) or `xlsx`. Overrides the `Accept` header. |
| `clientCode` | query | string | no | Customer card code, for reports that list `clientCode` in their filters. Needs `customers:read`. |
| `cardType` | query | string | no | Customer card type, for reports that list `cardType` in their filters. Needs `customers:read`. |

### Responses

- `200`: The report file.
- `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.
- `503`: The report took longer than 90 seconds. Try again with a shorter period.