# Agent skills (/agent-skills) An **agent skill** is a folder with instructions that a coding agent loads when it needs them. The `ajour-api` skill teaches an agent the Ajour API: authentication, endpoints, conventions, errors, rate limits and recipes. It also tells the agent to keep your API key secret and that the API is read-only. The skill follows the open [Agent Skills format](https://agentskills.io), so it works in Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode and many other agents. ## Install with the skills CLI [#install-with-the-skills-cli] The [`skills` CLI](https://github.com/vercel-labs/skills) installs the skill from this site. It needs Node.js 22.20 or newer. Run it in your project folder: ```bash npx skills add https://docs.ajour.dk ``` The CLI asks which agents to install the skill for. To choose one agent and skip the questions: ```bash npx skills add https://docs.ajour.dk --skill ajour-api -a claude-code -y ``` ```bash npx skills add https://docs.ajour.dk --skill ajour-api -a codex -y ``` ```bash npx skills add https://docs.ajour.dk --skill ajour-api -a cursor -y ``` ```bash npx skills add https://docs.ajour.dk --skill ajour-api -a github-copilot -y ``` ```bash npx skills add https://docs.ajour.dk --skill ajour-api -a gemini-cli -y ``` Add `-g` to install the skill for all your projects instead of one. Run `npx skills update` later to get a newer version. ## Install by hand [#install-by-hand] The skill is three files. Copy them to the skills folder of your agent, for example for Claude Code: ```bash mkdir -p ~/.claude/skills/ajour-api/references cd ~/.claude/skills/ajour-api curl -fsSO https://docs.ajour.dk/skills/ajour-api/SKILL.md curl -fsS -o references/endpoints.md https://docs.ajour.dk/skills/ajour-api/references/endpoints.md curl -fsS -o references/recipes.md https://docs.ajour.dk/skills/ajour-api/references/recipes.md ``` | File | What it has | | --- | --- | | [`SKILL.md`](/skills/ajour-api/SKILL.md) | Safety rules, authentication, endpoints, conventions, errors and limits | | [`references/endpoints.md`](/skills/ajour-api/references/endpoints.md) | Parameters and response fields of every endpoint | | [`references/recipes.md`](/skills/ajour-api/references/recipes.md) | CSV export, retries, nightly copy, report download, Power BI | The list of skills on this site is [`/.well-known/agent-skills/index.json`](/.well-known/agent-skills/index.json). ## Use the skill [#use-the-skill] 1. Set `AJOUR_API_KEY` in the environment where the agent runs. See [Authentication](/authentication/). 2. Ask the agent about your Ajour data, for example "Save last month's turnover per day as CSV". The agent loads the skill when the task is about Ajour. The skill tells the agent to read the key from `AJOUR_API_KEY` and never to print it. ## The skill [#the-skill] ````md title="SKILL.md" --- name: ajour-api description: Use the read-only Ajour Public API (api.ajour.dk/v1) to read a company's locations, products, sales key figures, sales breakdowns, sales lines and report files. Use when the user mentions Ajour, Ajour sales or turnover, Ajour reports, an AJOUR_API_KEY, or wants to export Ajour data to a spreadsheet, Power BI, a database or another system. --- # Ajour Public API The Ajour Public API is a read-only HTTP API. It returns one company's data: locations, product groups, products, sales figures, sales lines and report files. Every number matches the Ajour dashboard and reports. - Docs: https://docs.ajour.dk (for agents: https://docs.ajour.dk/llms-full.txt) - OpenAPI file: https://docs.ajour.dk/openapi/public-v1.json - Base URL: `https://api.ajour.dk/v1`. Every call is a `GET`. ## Safety rules - The API key is a secret. Read it from the `AJOUR_API_KEY` environment variable. Never print it, log it, put it in a URL, write it to a file in the repository, or show it in your answer. - If there is no key, tell the user to create one in the Ajour back office under **Settings → API keys** and to set `AJOUR_API_KEY`. Do not ask them to paste the key into the chat. - The API cannot change data. Do not promise to change products, prices or menus through it. ## Authentication ```bash curl https://api.ajour.dk/v1/company \ -H "Authorization: Bearer $AJOUR_API_KEY" ``` Always start with `GET /v1/company`. It shows the company, the key's scopes and the key's locations (`key.locationIds`, `null` = all locations). | Scope | Gives access to | | --- | --- | | `catalog:read` | locations, product groups, products | | `sales:read` | sales summary, breakdown, sales lines, salesperson names | | `reports:read` | report files (PDF, Excel) | | `customers:read` | reports with customer card data (off by default) | A location outside the key returns `404`, not `403`. ## Endpoints | Path | Scope | Use it for | | --- | --- | --- | | `/company` | any | the company and the key | | `/locations` | `catalog:read` | locations, with `lastSyncedAt` (data freshness) | | `/product-groups` | `catalog:read` | product groups (id = POS number) | | `/products`, `/products/{productId}` | `catalog:read` | products with prices (id = POS number) | | `/salespersons` | `sales:read` | names for the `salesperson` filter (last 13 months) | | `/sales/summary` | `sales:read` | key figures for a period (dashboard cards) | | `/sales/breakdown` | `sales:read` | figures grouped by `productGroup`, `product`, `location`, `salesperson`, `hour`, `weekday`, `day` or `month` | | `/sales` | `sales:read` | raw receipt lines (max 92 days) | | `/reports`, `/reports/{reportType}` | `reports:read` | report types, and a report as `pdf` or `xlsx` | Parameters and response fields: [references/endpoints.md](references/endpoints.md). ## Conventions - `from` and `to` are required for sales calls. They are local dates (`YYYY-MM-DD`) in Europe/Copenhagen. `to` is included. Summary and breakdown allow 366 days at most. - Money is in DKK with 2 decimals; responses have `"currency": "DKK"`. Amounts include VAT unless you pass `vat=exclude`. - Lists return `{ "data": [...], "nextCursor": "..." }`. Pass `nextCursor` as `cursor` until it is `null`. `limit` is 100 by default, 1000 at most. - Repeat a parameter for more values: `locationId=1031&locationId=1032`. - Products and product groups use POS numbers as string ids. Locations use numeric ids. - Use `updatedSince` (products, product groups) and `syncedSince` (sales lines) to copy only changes. - Ignore response fields you do not know. v1 only adds fields. ## Pick the right call - A total or a key figure → `/sales/summary`. Add `compare=previousYear` for last year. - A table or chart → `/sales/breakdown?groupBy=...`. Use `limit=10` for a top 10. - Raw rows for a warehouse → `/sales` with paging. - Do not add up sales lines to get figures. The summary and breakdown already match the dashboard. ## Errors and limits Errors are Problem Details (`application/problem+json`) with `type`, `title`, `status`, `detail`, `requestId` and sometimes `errors` per parameter. | Status | Meaning | Do | | --- | --- | --- | | 400 | wrong parameter format, key in the URL (`key-in-url`), or the `Impersonation-Company-Id` header | fix the request; a key sent in a URL must be revoked | | 401 | missing, wrong, revoked or expired key | check `AJOUR_API_KEY` | | 403 | missing scope, inactive company, or a report that needs a key for all locations | ask for a key with the scope or without a location limit | | 404 | unknown id, or location outside the key | check ids with `/locations` | | 422 | `to` before `from`, period too long, or a report call without exactly one `locationId` for a key with several locations | fix the dates, split the period, or pass one `locationId` | | 429 | rate limit | wait `Retry-After` seconds, then retry | | 503 | report took more than 90 seconds | ask for a shorter period | Limits: 120 requests per minute per key, 10 report files per minute. Responses have `RateLimit-Limit` and `RateLimit-Remaining`. Make calls one after another. ## Recipes Code for a CSV export, Power BI, a nightly copy and report downloads: [references/recipes.md](references/recipes.md). ```` # Using the API with AI agents (/ai-agents) AI agents and coding assistants, such as ChatGPT, Claude and Cursor, can write code that uses the Ajour API. Give them the files below and one of the prompts on this page. ## Files for AI agents [#files-for-ai-agents] | File | Use it for | | --- | --- | | [`/llms.txt`](/llms.txt) | A short index of this site, with a link to the Markdown of each page. | | [`/llms-full.txt`](/llms-full.txt) | All guide pages in one text file. | | [`/openapi/public-v1.json`](/openapi/public-v1.json) | The OpenAPI 3.0 description of every endpoint. Most agent tools can turn it into tools. | Each page also has a **Copy page** button, and a menu to open the page in ChatGPT, Claude or Cursor. ## Agent skill [#agent-skill] Coding agents such as Claude Code, Codex and Cursor can install the `ajour-api` skill. It teaches the agent the endpoints, conventions and safety rules, so you do not have to paste them each time. ```bash npx skills add https://docs.ajour.dk ``` See [Agent skills](/agent-skills/) for each agent and for the skill contents. Ajour does not have an MCP server. Agents call the HTTP API directly, with the OpenAPI file as the description. ## Prompts [#prompts] Start with the setup prompt. It tells the agent the rules of the API. Then use a task prompt below: copy it, change the dates and names, and paste it into your AI tool. ### Build a daily turnover export [#build-a-daily-turnover-export] ```text title="Prompt" Read the Ajour Public API docs: https://docs.ajour.dk/llms-full.txt and the OpenAPI file: https://docs.ajour.dk/openapi/public-v1.json Write a Python script that: - reads the API key from the AJOUR_API_KEY environment variable, - calls GET /v1/sales/breakdown with groupBy=day for last month, - saves date, quantity and turnover (DKK, including VAT) to turnover.csv, - waits for Retry-After seconds and tries again if the API returns 429. Do not put the API key in the code. ``` ### Connect Power BI [#connect-power-bi] ```text title="Prompt" Read the Ajour Public API docs: https://docs.ajour.dk/llms-full.txt Write a Power Query (M) query for Power BI that: - calls https://api.ajour.dk/v1/sales/breakdown with groupBy=location, from the first day of this month to today, - sends the header Authorization: Bearer , with the key as a parameter, - returns a table with the columns key, label, quantity and turnover. Explain where I paste it and which connection type to choose. ``` ### Copy sales lines every night [#copy-sales-lines-every-night] ```text title="Prompt" Read the Ajour Public API docs: https://docs.ajour.dk/llms-full.txt and the OpenAPI file: https://docs.ajour.dk/openapi/public-v1.json Write a script that copies new sales lines from GET /v1/sales to a SQLite database. - Store the newest syncedAt value and pass it as syncedSince on the next run. - Ask for the last 7 days with from and to, and follow nextCursor until it is null. - Use limit=1000 and skip lines whose id is already in the database. - Read the API key from the AJOUR_API_KEY environment variable. ``` ### Answer a question about my sales [#answer-a-question-about-my-sales] ```text title="Prompt" Use the Ajour Public API (docs: https://docs.ajour.dk/llms-full.txt). The API key is in the AJOUR_API_KEY environment variable. Which 10 products sold most in my shops in November 2026, and how does that compare with November 2025? Use GET /v1/sales/breakdown with groupBy=product, limit=10 and compare=previousYear. Do not add up sales lines yourself. ``` ## Facts an agent needs [#facts-an-agent-needs] - Base URL: `https://api.ajour.dk/v1`. Only `GET` calls. - Header: `Authorization: Bearer `. - Dates in `from` and `to` are local dates in Europe/Copenhagen. `to` is included. - Money is in DKK. `vat=include` is the default. - Lists return `{ "data": [...], "nextCursor": ... }`. Follow `nextCursor` until it is `null`. - Use `/v1/sales/summary` and `/v1/sales/breakdown` for figures. They match the Ajour dashboard. Do not add up sales lines. - On `429`, wait for `Retry-After` seconds. ## Keep the key safe [#keep-the-key-safe] Give the key to the agent through an environment variable or a secret store. - Give the agent a key with only the scopes it needs. For most questions about sales, `sales:read` is enough. - Limit the key to the locations the agent needs. - Revoke the key in **Settings → API keys** when you no longer need it. Version 1 is read-only. An agent cannot change your data through the API. # Authentication (/authentication) Every call needs an API key. A key belongs to one company. Ajour reads the company from the key, so you never send a company id. ## Create a key [#create-a-key] 1. Sign in to the Ajour back office. 2. Go to **Settings → API keys**. 3. Select **Create key**. 4. Enter a name that says who uses the key, for example "Power BI" or "Accounting partner". 5. Choose the [scopes](#scopes) and the [locations](#location-limits). 6. Optional: set an expiry date. 7. Copy the key and keep it in a safe place, such as a password manager. All users of your company can create, see and revoke your company's keys. Ajour support can also do this for you. Ajour stores only a hash of the key. If you lose the key, revoke it and create a new one. ## Key format [#key-format] ```text ajr_live_7Kq2Vx9b_Q3n8... │ │ │ └ secret │ │ └ key id (shown in the API keys list) │ └ live └ prefix ``` The `ajr_` prefix lets secret scanners find a key that was shared by mistake. ## Send the key [#send-the-key] Send the key in the `Authorization` header as a bearer token: ```sh curl https://api.ajour.dk/v1/company \ -H "Authorization: Bearer $AJOUR_API_KEY" ``` The API does not accept keys in the URL, because URLs are saved in logs. A key in the URL returns [`400 key-in-url`](/errors/key-in-url/). ## Scopes [#scopes] A scope gives the key access to a group of endpoints. Give each key only the scopes it needs. | Scope | Gives access to | | --- | --- | | `catalog:read` | Locations, product groups and products | | `sales:read` | Sales lines, key figures, breakdowns and salesperson names | | `reports:read` | Report files (PDF and Excel) | | `customers:read` | Reports with customer card holders' names, addresses and balances. **Off by default.** | `GET /v1/company` works with any scope. If the key does not have the scope that a call needs, the API returns [`403`](/errors/missing-scope/). ## Location limits [#location-limits] You can limit a key to some of your locations. For example, a chain can give a franchise partner a key that sees only that partner's shop. - Lists and figures include only the key's locations. - If you ask for a location outside the key, the API returns [`404`](/errors/not-found/). It does not show that the location exists. - `GET /v1/company` shows the key's locations in `key.locationIds`. `null` means all locations. ## Revoke a key [#revoke-a-key] Go to **Settings → API keys** and select **Revoke** next to the key. The key stops working at once. Calls with it return [`401`](/errors/unauthorized/). The API keys list shows when each key was last used. Revoke keys that nobody uses. ## Keep keys safe [#keep-keys-safe] - Keep keys on a server or in a password manager. Never put a key in a web page or a mobile app. - Use one key per system or partner, so you can revoke one without stopping the others. - Revoke a key at once if you think someone else has it. # 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. # Company is inactive (/errors/company-inactive) **Status:** `403` · **Type:** `https://docs.ajour.dk/errors/company-inactive` The key is valid, but the company's Ajour account is not active. The API does not return data for inactive companies. ## What to do [#what-to-do] Contact Ajour. See all [error types](/errors/). # Date range is too long (/errors/date-range-too-long) **Status:** `422` · **Type:** `https://docs.ajour.dk/errors/date-range-too-long` The period from `from` to `to` is too long. Sales key figures and breakdowns allow at most 366 days. Sales lines allow at most 92 days. ## What to do [#what-to-do] Split the period into shorter parts and make one call per part. See all [error types](/errors/). # Impersonation is not allowed (/errors/impersonation-not-allowed) **Status:** `400` · **Type:** `https://docs.ajour.dk/errors/impersonation-not-allowed` The request sent the `Impersonation-Company-Id` header. The public API does not accept it. The company always comes from the API key. ## What to do [#what-to-do] Remove the header. To read another company's data, use an API key of that company. See all [error types](/errors/). # Errors (/errors) When a call fails, the API returns an HTTP status code and a body in the standard **Problem Details** format ([RFC 9457](https://www.rfc-editor.org/rfc/rfc9457)). The content type is `application/problem+json`. ```http HTTP/1.1 422 Unprocessable Content Content-Type: application/problem+json X-Request-Id: 01JD3W6Y7P4T { "type": "https://docs.ajour.dk/errors/date-range-too-long", "title": "Date range is too long", "status": 422, "detail": "Sales lines allow at most 92 days. You asked for 120.", "requestId": "01JD3W6Y7P4T", "errors": { "to": ["Must be at most 92 days after from."] } } ``` | Field | Meaning | | --- | --- | | `type` | A link to a page that explains the error. Use it in your code to tell errors apart. It does not change. | | `title` | A short summary of the error type. | | `status` | The HTTP status code. | | `detail` | What went wrong in this request. The text can change. Do not use it in your code. | | `requestId` | The same id as the `X-Request-Id` header. Send it to Ajour support when you report a problem. | | `errors` | Only for invalid parameters: messages per parameter. | ## Error types [#error-types] | Status | Type | When | | --- | --- | --- | | `400` | [`invalid-parameter`](/errors/invalid-parameter/) | A parameter has the wrong format or an unknown value. | | `400` | [`impersonation-not-allowed`](/errors/impersonation-not-allowed/) | The request has the `Impersonation-Company-Id` header. | | `400` | [`key-in-url`](/errors/key-in-url/) | An API key was found in the URL. | | `401` | [`unauthorized`](/errors/unauthorized/) | The key is missing, wrong, revoked or expired. | | `403` | [`missing-scope`](/errors/missing-scope/) | The key does not have the scope the call needs. | | `403` | [`company-inactive`](/errors/company-inactive/) | The company's Ajour account is not active. | | `403` | [`report-needs-all-locations`](/errors/report-needs-all-locations/) | The report needs a key for all locations. | | `404` | [`not-found`](/errors/not-found/) | The item does not exist, or the location is outside the key. | | `422` | [`validation-failed`](/errors/validation-failed/) | `to` is before `from`. | | `422` | [`date-range-too-long`](/errors/date-range-too-long/) | The period is longer than the endpoint allows. | | `422` | [`location-required`](/errors/location-required/) | A key for several locations must name one `locationId` for a report. | | `429` | [`rate-limited`](/errors/rate-limited/) | Too many requests. Wait for `Retry-After` seconds. | | `503` | [`report-timeout`](/errors/report-timeout/) | A report took longer than 90 seconds. | ## Which errors to retry [#which-errors-to-retry] - Retry `429` after the `Retry-After` seconds. - Retry `503` with a shorter period. - Retry network errors and other `5xx` errors with a growing wait, for example 1, 2, 4 and 8 seconds. - Do not retry `400`, `401`, `403`, `404` or `422`. Fix the request first. # Invalid parameter (/errors/invalid-parameter) **Status:** `400` · **Type:** `https://docs.ajour.dk/errors/invalid-parameter` A query parameter cannot be read. For example, a date is not in the `YYYY-MM-DD` format, a number is not a number, or `groupBy` has an unknown value. The `errors` field lists the messages per parameter. ## What to do [#what-to-do] Check the parameter names and values against the [API reference](/api-reference/). Do not retry the same request. See all [error types](/errors/). # The key must not be in the URL (/errors/key-in-url) **Status:** `400` · **Type:** `https://docs.ajour.dk/errors/key-in-url` The query string has an API key (`ajr_live_...`). The API does not accept keys in the URL, because URLs are saved in logs, browser history and proxies. ## What to do [#what-to-do] - Send the key only in the header: `Authorization: Bearer `. - Revoke the key in **Settings → API keys** and create a new one, because it can now be in logs. See all [error types](/errors/). # Location required (/errors/location-required) **Status:** `422` · **Type:** `https://docs.ajour.dk/errors/location-required` The key is limited to more than one location. For such a key, a report file must be for exactly one location, so the call must have exactly one `locationId`. ## What to do [#what-to-do] Add one `locationId` to the report call, and make one call per location. Call `GET /v1/locations` to see the locations the key can see. A key for all locations does not have this rule. See all [error types](/errors/). # Missing scope (/errors/missing-scope) **Status:** `403` · **Type:** `https://docs.ajour.dk/errors/missing-scope` The key is valid, but it does not have the scope that this endpoint needs. The `detail` field names the scope. ## What to do [#what-to-do] Create a new key with the scope you need, in **Settings → API keys**. See [Scopes](/authentication/#scopes). See all [error types](/errors/). # Not found (/errors/not-found) **Status:** `404` · **Type:** `https://docs.ajour.dk/errors/not-found` The item you asked for does not exist for this company. For example, a product number is unknown. The API also returns `404` when you ask for a location that the key cannot see, so it does not show that the location exists. ## What to do [#what-to-do] - Check the id. Products and product groups use their POS number. - Call `GET /v1/locations` to see the locations the key can see. - Check the key's location limit in **Settings → API keys**. See all [error types](/errors/). # Too many requests (/errors/rate-limited) **Status:** `429` · **Type:** `https://docs.ajour.dk/errors/rate-limited` The key has made more requests than its [rate limit](/rate-limits/) allows. The `Retry-After` header says how many seconds to wait. ## What to do [#what-to-do] Wait for `Retry-After` seconds, then try again. Use the `RateLimit-Remaining` header to slow down before you reach the limit. See all [error types](/errors/). # Report needs all locations (/errors/report-needs-all-locations) **Status:** `403` · **Type:** `https://docs.ajour.dk/errors/report-needs-all-locations` The reports `logbook-per-salesperson` and `client-card-balances` cover the whole company. A key that is limited to some locations cannot get them. ## What to do [#what-to-do] Use a key without a location limit. Create one in **Settings → API keys**. See all [error types](/errors/). # Report took too long (/errors/report-timeout) **Status:** `503` · **Type:** `https://docs.ajour.dk/errors/report-timeout` The report file took longer than 90 seconds to build. This can happen with long periods or many locations. ## What to do [#what-to-do] Ask for a shorter period, or fewer locations, and try again. See all [error types](/errors/). # Unauthorized (/errors/unauthorized) **Status:** `401` · **Type:** `https://docs.ajour.dk/errors/unauthorized` The request has no valid API key. The `Authorization` header is missing, the key is wrong, or the key was revoked or has expired. The response also has the header `WWW-Authenticate: Bearer`. ## What to do [#what-to-do] - Send the key as `Authorization: Bearer `. - Check that you copied the whole key. - Check in **Settings → API keys** that the key is not revoked or expired. If it is, create a new key. See all [error types](/errors/). # Validation failed (/errors/validation-failed) **Status:** `422` · **Type:** `https://docs.ajour.dk/errors/validation-failed` The value of `to` is before the value of `from`. `to` is the last day of the period and is included, so `from` and `to` can be the same day. The `errors` field names the parameter. ## What to do [#what-to-do] Send a `from` date that is on or before the `to` date. See all [error types](/errors/). # Introduction (/) The Ajour Public API lets you read your own Ajour data from other systems: a spreadsheet, Power BI, your accounting system or an AI agent. Version 1 is **read-only**, and every number matches the Ajour dashboard and reports. ## Get started [#get-started] ## How it works [#how-it-works] ### Create a key [#create-a-key] In the Ajour back office, go to **Settings → API keys**. Choose the scopes and the locations the key can see. Ajour shows the key one time. ### Keep the key safe [#keep-the-key-safe] Store it in an environment variable or a secret store, for example `AJOUR_API_KEY`. Never put it in a web page or a chat. ### Call the API [#call-the-api] Send `GET` requests to `https://api.ajour.dk/v1` with `Authorization: Bearer `. Start with `/v1/company`. ### Use the data [#use-the-data] Load the figures into a spreadsheet, Power BI or your own system, or let an AI agent answer questions about your sales. ## What you can read [#what-you-can-read] Your company, your locations, product groups and products with prices. Turnover, transactions, average receipt and margin for any period. The same figures as the dashboard cards. Sales per product group, product, location, salesperson, hour, weekday, day or month. Every receipt line, and the Ajour reports as PDF or Excel files. ## At a glance [#at-a-glance] | What | Value | | --- | --- | | Base URL | `https://api.ajour.dk/v1` | | Format | JSON, UTF-8 | | Authentication | `Authorization: Bearer ` | | OpenAPI file | [`/openapi/public-v1.json`](/openapi/public-v1.json) | ## First call [#first-call] ```bash curl https://api.ajour.dk/v1/company \ -H "Authorization: Bearer $AJOUR_API_KEY" ``` # Quick start (/quick-start) ### Create an API key [#create-an-api-key] Sign in to the Ajour back office. Go to **Settings → API keys** and select **Create key**. Give the key a name, choose its scopes, and choose the locations it can see. For this guide, select `catalog:read` and `sales:read`. Copy the key. Ajour shows it **one time only**. It looks like this: ```text ajr_live_7Kq2Vx9b_Q3n8... ``` ### Keep the key in an environment variable [#keep-the-key-in-an-environment-variable] ```bash export AJOUR_API_KEY="ajr_live_7Kq2Vx9b_Q3n8..." ``` Do not put the key in source code, a URL or an e-mail. ### Check the key [#check-the-key] ```bash curl https://api.ajour.dk/v1/company \ -H "Authorization: Bearer $AJOUR_API_KEY" ``` The response shows your company and the key's scopes and locations: ```json { "id": 412, "name": "Café Nørrebro ApS", "cvr": "12345678", "currency": "DKK", "timeZone": "Europe/Copenhagen", "workHours": { "start": "07:00", "end": "23:00" }, "key": { "keyId": "7Kq2Vx9b", "scopes": ["catalog:read", "sales:read"], "locationIds": null } } ``` ### List your locations [#list-your-locations] ```bash curl https://api.ajour.dk/v1/locations \ -H "Authorization: Bearer $AJOUR_API_KEY" ``` ### Get the key figures for a period [#get-the-key-figures-for-a-period] ```bash curl "https://api.ajour.dk/v1/sales/summary?from=2026-11-01&to=2026-11-21" \ -H "Authorization: Bearer $AJOUR_API_KEY" ``` ```python import os, requests response = requests.get( "https://api.ajour.dk/v1/sales/summary", params={"from": "2026-11-01", "to": "2026-11-21"}, headers={"Authorization": f"Bearer {os.environ['AJOUR_API_KEY']}"}, timeout=60, ) response.raise_for_status() print(response.json()["metrics"]["totalTurnover"]) ``` ```js const url = new URL('https://api.ajour.dk/v1/sales/summary'); url.search = new URLSearchParams({ from: '2026-11-01', to: '2026-11-21' }); const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.AJOUR_API_KEY}` }, }); if (!response.ok) throw new Error(`Ajour API error ${response.status}`); const summary = await response.json(); console.log(summary.metrics.totalTurnover); ``` ```json { "period": { "from": "2026-11-01", "to": "2026-11-21" }, "currency": "DKK", "vat": "include", "metrics": { "totalTurnover": 486210.50, "posTurnover": 451900.00, "onlineTurnover": 34310.50, "transactions": 6120, "averageTransaction": 79.45, "discount": 8120.00, "returns": 1340.00, "contributionMargin": 301455.20, "contributionMarginPercent": 62.0 } } ``` These are the same figures as the key figure cards on your Ajour dashboard. ### Get sales per product group [#get-sales-per-product-group] ```bash curl "https://api.ajour.dk/v1/sales/breakdown?groupBy=productGroup&from=2026-11-01&to=2026-11-21" \ -H "Authorization: Bearer $AJOUR_API_KEY" ``` ## Next steps [#next-steps] Scopes, location limits and how to revoke a key. Dates, money, paging and ids. Spreadsheets, Power BI and nightly copies. Every endpoint, parameter and response. # Rate limits (/rate-limits) Each API key has its own limits. Keys do not share limits, even in the same company. | Limit | Value | | --- | --- | | Requests per key | 120 per minute | | Report files per key (`GET /v1/reports/{reportType}`) | 10 per minute | Report files count toward both limits. ## Headers [#headers] Every successful response tells you where you are: ```http RateLimit-Limit: 120 RateLimit-Remaining: 117 ``` - `RateLimit-Limit` is the number of requests the key may make per minute. - `RateLimit-Remaining` is the number of requests the key has left in the current minute. ## When you reach the limit [#when-you-reach-the-limit] The API returns `429 Too Many Requests` with a [`rate-limited`](/errors/rate-limited/) error and a `Retry-After` header: ```http HTTP/1.1 429 Too Many Requests Retry-After: 18 Content-Type: application/problem+json ``` Wait for `Retry-After` seconds, then try again. ## Stay under the limit [#stay-under-the-limit] - Use `/v1/sales/summary` and `/v1/sales/breakdown` for figures. Do not add up sales lines yourself. - Slow down when `RateLimit-Remaining` gets low. - Use `limit=1000` when you copy lists. - Use `updatedSince` and `syncedSince` to copy only what changed. - Make calls one after another, not many at the same time. # Recipes (/recipes) All examples read the key from the `AJOUR_API_KEY` environment variable. See [Quick start](/quick-start/). ## Daily turnover to a spreadsheet [#daily-turnover-to-a-spreadsheet] Get the turnover per day for a month and save it as a CSV file. You can open the file in Excel, Numbers or Google Sheets. ```sh curl -s "https://api.ajour.dk/v1/sales/breakdown?groupBy=day&from=2026-11-01&to=2026-11-30" \ -H "Authorization: Bearer $AJOUR_API_KEY" \ | jq -r '["date","quantity","turnover_dkk"], (.rows[] | [.key, .quantity, .turnover]) | @csv' \ > turnover-november.csv ``` The same in Python: ```python import csv, os, requests response = requests.get( "https://api.ajour.dk/v1/sales/breakdown", params={"groupBy": "day", "from": "2026-11-01", "to": "2026-11-30"}, headers={"Authorization": f"Bearer {os.environ['AJOUR_API_KEY']}"}, timeout=60, ) response.raise_for_status() with open("turnover-november.csv", "w", newline="") as f: writer = csv.writer(f) writer.writerow(["date", "quantity", "turnover_dkk"]) for row in response.json()["rows"]: writer.writerow([row["key"], row["quantity"], row["turnover"]]) ``` Add `vat=exclude` to get turnover without VAT. ## Sales per location [#sales-per-location] Compare your locations for a period, with last year's figures for the same weekdays: ```sh curl "https://api.ajour.dk/v1/sales/breakdown?groupBy=location&from=2026-11-01&to=2026-11-30&compare=previousYear" \ -H "Authorization: Bearer $AJOUR_API_KEY" ``` ```json { "groupBy": "location", "period": { "from": "2026-11-01", "to": "2026-11-30" }, "currency": "DKK", "vat": "include", "rows": [ { "key": "1031", "label": "Nørrebrogade", "quantity": 8120, "turnover": 301200.00, "share": 61.9, "previousYear": { "quantity": 7740, "turnover": 279850.00 } }, { "key": "1032", "label": "Vesterbro", "quantity": 4760, "turnover": 185010.50, "share": 38.1, "previousYear": { "quantity": 4610, "turnover": 162020.00 } } ], "total": { "quantity": 12880, "turnover": 486210.50 } } ``` Other values for `groupBy`: `productGroup`, `product`, `salesperson`, `hour`, `weekday`, `day` and `month`. Use `groupBy=product&limit=10` for the 10 most popular products. ## Download a report as PDF [#download-a-report-as-pdf] The key needs the `reports:read` scope. ```sh curl "https://api.ajour.dk/v1/reports/total-sales?from=2026-11-01&to=2026-11-30&format=pdf" \ -H "Authorization: Bearer $AJOUR_API_KEY" \ -o total-sales-november.pdf ``` If the key is limited to more than one location, a report must be for one location: add exactly one `locationId`. The reports `logbook-per-salesperson` and `client-card-balances` need a key for all locations. Use `format=xlsx` for an Excel file. Call `GET /v1/reports` to see all report types and the filters each one accepts. A report can take up to 90 seconds to build. ## Copy all sales lines every night [#copy-all-sales-lines-every-night] Store the newest `syncedAt` you have received. The next night, pass it as `syncedSince` and follow `nextCursor` until it is `null`. ```python import os, requests API = "https://api.ajour.dk/v1" HEADERS = {"Authorization": f"Bearer {os.environ['AJOUR_API_KEY']}"} def fetch_new_lines(from_date, to_date, synced_since): params = {"from": from_date, "to": to_date, "syncedSince": synced_since, "limit": 1000} while True: page = requests.get(f"{API}/sales", params=params, headers=HEADERS, timeout=60) page.raise_for_status() body = page.json() yield from body["data"] if not body["nextCursor"]: break params["cursor"] = body["nextCursor"] ``` A register can send sales some time after the sale. So ask for a few days back with `from`, and use `syncedSince` to skip lines you already have. Use `id` to find duplicates. ## Power BI and Excel [#power-bi-and-excel] Power BI and Excel can read the API with **Power Query**. Use **Get Data → Blank query**, open the **Advanced editor**, and paste: ```text let ApiKey = "ajr_live_...", Response = Json.Document( Web.Contents( "https://api.ajour.dk/v1/sales/breakdown", [ Query = [groupBy = "day", from = "2026-11-01", to = "2026-11-30"], Headers = [Authorization = "Bearer " & ApiKey] ] ) ), Rows = Table.FromRecords(Response[rows]) in Rows ``` When Power BI asks how to connect, choose **Anonymous**. The key is already in the header. Anyone who can open the file can read the key. Share the file only with people who may see the data. Use a key with only the scopes and locations they need. # Versioning (/versioning) The version is in the path: `https://api.ajour.dk/v1/...`. ## Changes inside v1 [#changes-inside-v1] Inside v1, Ajour only adds things: - new endpoints - new fields in responses - new optional parameters - new values in lists that say so, such as report types Your code must ignore fields it does not know. Then these changes do not break it. ## Breaking changes [#breaking-changes] A change that can break your code comes in a new version, `/v2`. Examples are a removed field, a renamed field or a changed meaning. When v2 comes, v1 stays for **at least 12 months**. During that time, v1 responses have two extra headers, for example: ```http Deprecation: @1798761600 Sunset: Sat, 01 Jan 2028 00:00:00 GMT ``` - `Deprecation` says that v1 will be removed. - `Sunset` is the date after which v1 stops working. Check for these headers in your code or logs, so you know when to move to the new version. # Overview (/api-reference) The reference is generated from the [OpenAPI file](/openapi/public-v1.json). All endpoints are `GET` calls on `https://api.ajour.dk/v1` and need an [API key](/authentication). | Method | Path | Scope | Returns | | --- | --- | --- | --- | | `GET` | `/company` | any | The company that owns the key | | `GET` | `/locations` | `catalog:read` | Locations the key can see | | `GET` | `/product-groups` | `catalog:read` | Product groups | | `GET` | `/products` | `catalog:read` | Products with prices | | `GET` | `/products/{productId}` | `catalog:read` | One product | | `GET` | `/salespersons` | `sales:read` | Salesperson names from the last 13 months | | `GET` | `/sales/summary` | `sales:read` | Key figures for a period | | `GET` | `/sales/breakdown` | `sales:read` | Sales grouped by one dimension | | `GET` | `/sales` | `sales:read` | Raw sales lines | | `GET` | `/reports` | `reports:read` | Report types you can download | | `GET` | `/reports/{reportType}` | `reports:read` | A report as PDF or Excel | Choose an endpoint in the menu to see its parameters, responses and code examples. # Get the company that owns the key (/api-reference/company-and-catalog/getCompany) ## GET https://api.ajour.dk/v1/company Returns the company the API key belongs to, and the key's own scopes and locations. Works with any scope. Use it as your first test call. ### 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. - `429`: Too many requests for this key. Wait for `Retry-After` seconds. Example `200` response: ```json { "id": 412, "name": "Café Nørrebro ApS", "cvr": "12345678", "currency": "DKK", "timeZone": "Europe/Copenhagen", "workHours": { "start": "07:00", "end": "23:00" }, "key": { "keyId": "7Kq2Vx9b", "scopes": [ "catalog:read", "sales:read" ], "locationIds": null } } ``` # List locations (/api-reference/company-and-catalog/listLocations) ## GET https://api.ajour.dk/v1/locations The company's locations (shops) that the key can see. Deleted locations are left out. `lastSyncedAt` is the upload time of the newest sale from that location, so you can see how fresh the data is. All locations come on one page. Requires scope `catalog:read`. ### 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. - `429`: Too many requests for this key. Wait for `Retry-After` seconds. Example `200` response: ```json { "data": [ { "id": 1031, "name": "Nørrebrogade", "lastSyncedAt": "2026-11-22T16:05:12Z" }, { "id": 1032, "name": "Vesterbro", "lastSyncedAt": "2026-11-22T15:58:40Z" } ], "nextCursor": null } ``` # List product groups (/api-reference/company-and-catalog/listProductGroups) ## GET https://api.ajour.dk/v1/product-groups Product groups with their POS number as `id`, sorted by POS number. Use `updatedSince` to copy only changes. Requires scope `catalog:read`. ### Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `updatedSince` | query | string (date-time) | no | Only items changed after this time. | | `limit` | query | integer (int32) | no | Items per page. | | `cursor` | query | string | no | The `nextCursor` value from the previous page. | ### 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. - `429`: Too many requests for this key. Wait for `Retry-After` seconds. Example `200` response: ```json { "data": [ { "id": "10", "name": "Kaffe", "updatedAt": "2026-09-02T08:11:00+02:00" }, { "id": "20", "name": "Kage", "updatedAt": "2026-10-14T12:30:00+02:00" } ], "nextCursor": "MjA" } ``` # List products (/api-reference/company-and-catalog/listProducts) ## GET https://api.ajour.dk/v1/products The product catalogue with prices from the Ajour back office, sorted by POS number. `stock` is filled only when the product tracks stock. Requires scope `catalog:read`. ### Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `productGroupId` | query | string | no | Only products in this product group (POS number). | | `updatedSince` | query | string (date-time) | no | Only items changed after this time. | | `limit` | query | integer (int32) | no | Items per page. | | `cursor` | query | string | no | The `nextCursor` value from the previous page. | ### 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. - `429`: Too many requests for this key. Wait for `Retry-After` seconds. Example `200` response: ```json { "data": [ { "id": "1001", "name": "Cappuccino", "productGroupId": "10", "kind": "single", "salesPrice": 42, "costPrice": 9.5, "vatPercent": 25, "barcode": null, "trackStock": false, "stock": null, "updatedAt": "2026-11-03T10:02:00+01:00" } ], "nextCursor": null } ``` # Get one product (/api-reference/company-and-catalog/getProduct) ## GET https://api.ajour.dk/v1/products/{productId} One product by its POS number. Same shape as one item in the product list. Returns `404` if the number is unknown for this company. Requires scope `catalog:read`. ### Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `productId` | path | string | yes | POS product number. | ### 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. - `429`: Too many requests for this key. Wait for `Retry-After` seconds. Example `200` response: ```json { "id": "1001", "name": "Cappuccino", "productGroupId": "10", "kind": "single", "salesPrice": 42, "costPrice": 9.5, "vatPercent": 25, "barcode": null, "trackStock": false, "stock": null, "updatedAt": "2026-11-03T10:02:00+01:00" } ``` # List salesperson names (/api-reference/company-and-catalog/listSalespersons) ## GET https://api.ajour.dk/v1/salespersons The salesperson names found on sales in the key's locations in the last 13 months. Registers store names, not ids, so use the name in the `salesperson` filter. All names come on one page. Requires scope `sales:read`. ### 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. - `429`: Too many requests for this key. Wait for `Retry-After` seconds. Example `200` response: ```json { "data": [ { "name": "Anna" }, { "name": "Mikkel" } ], "nextCursor": null } ``` # List report types (/api-reference/reports/listReports) ## GET https://api.ajour.dk/v1/reports Each report you can download, with its formats and the filters it accepts besides `from` and `to`. Reports with customer card data show only when the key has the `customers:read` scope. Reports that always cover all locations are left out for keys limited to some locations. Requires scope `reports:read`. ### 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. - `429`: Too many requests for this key. Wait for `Retry-After` seconds. Example `200` response: ```json { "data": [ { "type": "total-sales", "name": "Total sales", "formats": [ "pdf", "xlsx" ], "filters": [ "locationId", "productGroupId", "productId", "orderType", "salesperson" ] }, { "type": "turnover-per-guest", "name": "Turnover per guest", "formats": [ "pdf", "xlsx" ], "filters": [ "locationId", "salesperson" ] } ], "nextCursor": null } ``` # 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. # Get key figures for a period (/api-reference/sales/getSalesSummary) ## GET https://api.ajour.dk/v1/sales/summary The same key figures as the cards on the Ajour dashboard. Add `compare=previousYear` to also get last year's figures for the same weekdays, aligned the same way as the dashboard. The period can be at most 366 days. Requires scope `sales:read`. ### Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `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. | | `metrics` | query | array of `totalTurnover`, `posTurnover`, `onlineTurnover`, `transactions`, `averageTransaction`, `discount`, `returns`, `contributionMargin`, `contributionMarginPercent` | no | Only return these figures. Repeat the parameter for more than one. Leave out to get all. | | `compare` | query | `previousYear` | no | Add last year's figures for the same weekdays. | ### 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 { "period": { "from": "2026-11-01", "to": "2026-11-21" }, "currency": "DKK", "vat": "include", "metrics": { "totalTurnover": 486210.5, "posTurnover": 451900, "onlineTurnover": 34310.5, "transactions": 6120, "averageTransaction": 79.45, "discount": 8120, "returns": 1340, "contributionMargin": 301455.2, "contributionMarginPercent": 62 }, "previousYear": { "period": { "from": "2025-11-02", "to": "2025-11-22" }, "metrics": { "totalTurnover": 441870, "posTurnover": 410020, "onlineTurnover": 31850, "transactions": 5893, "averageTransaction": 74.98, "discount": 7710, "returns": 1205, "contributionMargin": 272190.4, "contributionMarginPercent": 61.6 } } } ``` # 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 } ``` # List sales lines (/api-reference/sales/listSales) ## GET https://api.ajour.dk/v1/sales Every receipt line, for when you build your own figures or copy data to a data warehouse. Lines with the same `receiptNumber` and `locationId` make one receipt. These are the lines the dashboard counts, so the sum of `amountInclVat` matches `totalTurnover` of the summary. `vat` has no effect here; each line has both amounts. Sorted by date, then id. For a nightly copy, store the newest `syncedAt` you have and pass it as `syncedSince` next time. The period can be at most 92 days. Requires scope `sales:read`. ### Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `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. | | `syncedSince` | query | string (date-time) | no | Only lines uploaded to Ajour after this time. | | `limit` | query | integer (int32) | no | Items per page. | | `cursor` | query | string | no | The `nextCursor` value from the previous page. | ### 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 { "data": [ { "id": "88213904", "locationId": 1031, "date": "2026-11-21T08:14:52+01:00", "receiptNumber": 204511, "orderType": "pos", "lineType": "product", "product": { "id": "1001", "name": "Cappuccino" }, "productGroupId": "10", "quantity": 2, "unitPrice": 42, "discount": 0, "amountInclVat": 84, "amountExclVat": 67.2, "isReturn": false, "salesperson": "Anna", "syncedAt": "2026-11-21T08:20:03Z" } ], "nextCursor": "NjM5MzA4NDIwOTIwMDAwMDAwLjg4MjEzOTA0" } ```