Using the API with AI agents
Give an AI agent or coding assistant what it needs to use the Ajour API.
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
| File | Use it for |
|---|---|
/llms.txt | A short index of this site, with a link to the Markdown of each page. |
/llms-full.txt | All guide pages in one text file. |
/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
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.
npx skills add https://docs.ajour.dkSee 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
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.
Start with your agent
Paste one prompt into Claude, ChatGPT or Cursor.
Build a daily turnover export
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
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 <key>, 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
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
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
- Base URL:
https://api.ajour.dk/v1. OnlyGETcalls. - Header:
Authorization: Bearer <key>. - Dates in
fromandtoare local dates in Europe/Copenhagen.tois included. - Money is in DKK.
vat=includeis the default. - Lists return
{ "data": [...], "nextCursor": ... }. FollownextCursoruntil it isnull. - Use
/v1/sales/summaryand/v1/sales/breakdownfor figures. They match the Ajour dashboard. Do not add up sales lines. - On
429, wait forRetry-Afterseconds.
Keep the key safe
Never paste an API key into a chat
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:readis 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.