# Conventions (/conventions)

## Format [#format]

- Requests and responses use JSON in UTF-8.
- Field names use `camelCase`.
- Ajour can add new fields to a response. Your code must ignore fields it does not know.
- Version 1 has only `GET` calls. You can safely retry every call.

## Dates and times [#dates-and-times]

- `from` and `to` are calendar dates, for example `2026-11-01`.
- They are local dates in the company's time zone, **Europe/Copenhagen**.
- `to` is included. `from=2026-11-01&to=2026-11-30` is all of November.
- Timestamps use ISO 8601 with an offset, for example `2026-11-14T19:42:10+01:00`.

The longest period you can ask for:

| Endpoint | Max period |
| --- | --- |
| `/v1/sales/summary`, `/v1/sales/breakdown` | 366 days |
| `/v1/sales` | 92 days |

## Money [#money]

- Money amounts are JSON numbers with 2 decimals.
- All amounts are in Danish kroner. Responses with money also have `"currency": "DKK"`.
- Choose amounts with or without VAT with `vat=include` (the default) or `vat=exclude`. This is the same switch as in the dashboard.

## Lists and paging [#lists-and-paging]

Every list has the same shape:

```json
{
  "data": [ ... ],
  "nextCursor": "eyJpZCI6IjIwIn0"
}
```

- `limit` sets the page size. The default is 100. The maximum is 1000.
- To get the next page, send `nextCursor` as `cursor`.
- When `nextCursor` is `null`, you have the last page.

Cursor paging stays correct while new sales arrive. Keep all other parameters the same when you ask for the next page.

```sh
curl "https://api.ajour.dk/v1/products?limit=500&cursor=eyJpZCI6IjIwIn0" \
  -H "Authorization: Bearer $AJOUR_API_KEY"
```

## Ids [#ids]

- Products and product groups use their **POS number**, the number your registers already use. It is a string, for example `"1001"`.
- Locations use the Ajour location id, a number, for example `1031`.
- Salespersons are identified by their name as on the register.

## Copy only what changed [#copy-only-what-changed]

Lists that you copy to your own system can return only new or changed rows:

| Endpoint | Parameter | Compare with |
| --- | --- | --- |
| `/v1/products`, `/v1/product-groups` | `updatedSince` | `updatedAt` |
| `/v1/sales` | `syncedSince` | `syncedAt` |

Store the newest value you have received. Send it next time.

## Sales filters [#sales-filters]

The sales endpoints and report files take the same filters as the dashboard and report filter bar:

| Parameter | Type | Notes |
| --- | --- | --- |
| `from`, `to` | date, required | Local dates. `to` is included. |
| `locationId` | integer, repeatable | Leave out for all locations the key can see. |
| `productGroupId` | string | POS product group number. |
| `productId` | string, repeatable | POS product numbers. |
| `orderType` | `pos`, `online`, `invoice`; repeatable | |
| `salesperson` | string | Name as on the register. |
| `vat` | `include` or `exclude` | Default `include`. |

Repeat a parameter to send more than one value:

```text
/v1/sales/summary?from=2026-11-01&to=2026-11-30&locationId=1031&locationId=1032
```

## Request id [#request-id]

Every response has an `X-Request-Id` header. Error responses also have it as `requestId`. Send this id to Ajour support when you report a problem.

## Data freshness [#data-freshness]

The registers send their sales to Ajour regularly. The API shows the data that has arrived. `GET /v1/locations` shows `lastSyncedAt` for each location, the time of the newest upload.