Vai al contenuto principale

Crea i tuoi report bookingkit con un assistente AI

Guida passo passo per i venditori su come utilizzare un assistente AI (ad esempio Claude) e l’API v3 di Bookingkit per creare report CSV completamente personalizzati sul proprio computer.

Scritto da Björn Blankenhagen

Applicabile a: BusinessKit e superiori · API v3 · Mac e Windows

⚠️ Nota sull'utilizzo delle API: Creare ed eseguire report in questo modo consuma il tuo quota API bookingkit. Un report mensile degli ordini utilizza tipicamente alcune centinaia o migliaia di richieste per ogni esecuzione. Hai un budget mensile di 500.000 richieste e riceverai email di avviso al 50 %, 80 %, 90 % e 100 %.

Cosa ottieni

Un report dei tuoi ordini bookingkit – esattamente le colonne di cui hai bisogno, nell'ordine che preferisci – come file CSV sul tuo computer, apribile in Excel. Descrivi il report in linguaggio semplice e un assistente AI scrive ed esegue il codice per te.

Una volta configurato, produrre il report del mese successivo richiede una sola frase.

Questo strumento è quello giusto per te se hai bisogno dello stesso report ogni mese con un layout di colonne fisso, se hai bisogno di più dati di quelli forniti dall'esportazione standard, o se il tuo report deve combinare più elementi (ad esempio ricavi e numero di partecipanti per centro di costo).

Questo strumento non fa per te se vuoi semplicemente cercare qualcosa una volta sola – usa le esportazioni standard di bookingkit per questo.

Perché non Google Sheets? I report creati come Google Apps Script raggiungono i limiti di Google: gli script vengono interrotti dopo pochi minuti e Google limita il numero di richieste che possono effettuare. Un report che copre un intero mese di ordini richiede diverse centinaia di richieste e si scontra regolarmente con questi limiti. Eseguirlo sul proprio computer elimina entrambi i limiti e può memorizzare i dati già recuperati, rendendo le esecuzioni successive molto più veloci.


Prima di iniziare

1. Verifica il tuo piano. L'accesso alle API richiede un account BusinessKit o superiore.

2. Richiedi le credenziali API. Non esiste una schermata self-service per questo – contatta il supporto bookingkit tramite chat e chiedi le credenziali API v3. Comunica loro:

  • che desideri accesso in sola lettura per i report;

  • gli ambiti necessari: orders_read_owned (o orders_read_all se sei un marketplace) e calendar_read;

  • che vorresti anche le credenziali sandbox per i test.

Riceverai un Client ID e un Client Secret. Conservali in un posto sicuro – consentono l'accesso ai tuoi dati di prenotazione.

3. Installa un assistente AI in grado di lavorare con i file sul tuo computer. Funziona uno qualsiasi dei seguenti:

  • Claude Code – https://claude.com/claude-code (gli esempi qui sotto usano questo programma)

  • Gemini CLI

  • Cursor o un altro assistente AI con accesso ai tuoi file

Una finestra di chat nel browser da sola non è sufficiente, perché non può eseguire il report per te. Se è tutto ciò che hai a disposizione, l'assistente può comunque scrivere lo script e tu lo esegui manualmente – ma la configurazione qui sotto è molto più semplice.


Passo 1 – Crea una cartella

Crea una cartella vuota sul tuo computer, ad esempio bookingkit-reports nei tuoi Documenti. Apri il tuo assistente AI in quella cartella.

Con Claude Code: apri il Terminale, digita cd (con uno spazio), trascina la cartella nella finestra del Terminale, premi Invio e poi digita claude.


Passo 2 – Incolla il prompt di configurazione

Copia tutto il contenuto del riquadro qui sotto e incollalo nell'assistente. Devi farlo una sola volta.

I want to build a custom report from the bookingkit API v3 in this folder. I am not a programmer, so please explain each step in plain language and do not ask me to edit any code.  Please open this page and follow the "Agent instructions" section on it exactly: https://help.bookingkit.com/it/articles/16734360-crea-i-tuoi-report-bookingkit-con-un-assistente-ai  If you cannot open web pages, tell me and I will paste those instructions in myself.  Start by setting up the folder and telling me what you need from me.

L'assistente verificherà cosa è installato sul tuo computer, configurerà la cartella e creerà un file per le tue credenziali.

Se il tuo assistente non riesce ad aprire i link, copia la sezione „Agent Instructions" in fondo a questo articolo e incollala al suo posto. Il contenuto è identico.


Passo 3 – Inserisci le tue credenziali

L'assistente crea un file chiamato credentials.txt con i valori lasciati vuoti. Aprilo in un editor di testo, inserisci il Client ID e il Client Secret ricevuti dal supporto e salva il file.

Non incollare il tuo Client Secret nella chat. Tutto ciò che digiti in un assistente AI viene inviato ai server di quel fornitore. Inserendolo nel file invece, rimane sul tuo computer – lo script lo legge direttamente da lì.

Lascia environment=sandbox mentre esegui i test. Cambialo in production solo quando i numeri sono corretti.


Passo 4 – Descrivi il tuo report

Comunicali all'assistente cosa desideri. Copia questo modello e compilalo – più sei preciso/a, meno domande ci saranno:

Report name:        es. Report mensile centri di costo Date basis:        service date (data dell'attività)                    OPPURE booking date (data della prenotazione) Date range:        es. sempre l'ultimo mese solare completo Which orders:      solo accettati, o incluse le cancellazioni One row per:       order (consigliato), ticket o partecipante Columns, in order: es. codice prenotazione, data prenotazione, data servizio, nome evento,                    partecipanti, ricavo lordo, ricavo netto, metodo di pagamento Filters:           es. solo eventi che contengono "Visita al castello" Exclude:           es. tutti gli eventi che contengono "Kombiticket" VAT:               es. 0 % per il centro di costo X, altrimenti usa il valore API Output:            es. out/report-centri-costo_2026-07.csv Excel language:    German o English

Non sei sicuro/a su „Date basis"? Per i report contabili si usa quasi sempre la data del servizio – il mese in cui si è svolta l'attività, non quello in cui il cliente ha prenotato.

L'assistente recupererà i dati, scriverà il file CSV e ti mostrerà un riepilogo.


Passo 5 – Verifica i numeri

Prima di affidarti al report, confrontalo con l'esportazione standard di bookingkit per lo stesso mese. Controlla il numero di ordini e il fatturato totale.

Se non corrispondono, comunicalo all'assistente – conosce le cause più comuni e può correggerle. Le più frequenti sono: prenotazioni cancellate incluse o escluse in modo errato, Kombiticket contati due volte, oppure lordo e netto invertiti.


Ogni mese, da questo momento in poi

Apri la cartella, avvia il tuo assistente e di':

run the monthly order report for last month

È tutto. L'assistente ha memorizzato le specifiche del tuo report la prima volta, quindi conosce già le colonne, i filtri e il formato. Torna a questo articolo solo se vuoi modificare il contenuto del report.


Risoluzione dei problemi

Cosa vedi

Cosa significa

Cosa fare

429 con error_code 42901

Lo script ha richiesto un secondo access token mentre uno era ancora valido. È consentito solo uno per ora.

Di' all'assistente di riutilizzare il token memorizzato nella cache.

429 con error_code 42910

Il tuo limite mensile di 500.000 richieste API è esaurito.

Aspettare non aiuta – il limite si ripristina solo il 1° del mese successivo. Contatta il supporto per aumentarlo.

401 Unauthorized

Credenziali errate o token scaduto.

Controlla credentials.txt per errori di battitura e spazi indesiderati. Conferma con il supporto che i tuoi ambiti includono orders_read_owned.

403 o risultati vuoti in production

Le tue credenziali potrebbero essere valide solo per la sandbox, o manca un ambito.

Controlla environment= in credentials.txt, poi chiedi al supporto di confermare i tuoi ambiti.

La colonna „Nome evento" è vuota

Gli eventi su richiesta mancano dall'elenco degli eventi.

Di' all'assistente: „pass type=ALL when fetching vendor events".

Le cancellazioni mancano

L'API restituisce solo gli ordini accettati per impostazione predefinita.

Di' all'assistente che vuoi status=ALL.

Il fatturato è troppo alto

I Kombiticket vengono contati due volte, o i partecipanti cancellati sono inclusi.

Chiedi di escludere i Kombiticket e di verificare entrambi i livelli di cancellazione.

I totali non tornano

Lordo e netto sono invertiti. I prezzi dei biglietti sono lordi – il netto deve essere calcolato dall'aliquota IVA.

Chiedi all'assistente di ricontrollare la conversione lordo/netto.

Excel mostra ü invece di ü

Il file è stato salvato senza Byte Order Mark.

Chiedi che il file CSV venga scritto in UTF-8 con BOM.

Excel mostra tutto in una colonna

Il tuo Excel si aspetta un separatore diverso.

Di' all'assistente quale lingua di Excel usi.

I numeri non possono essere sommati in Excel

Sono stati scritti come testo.

Chiedi numeri semplici con virgola decimale e senza simbolo di valuta.

Lo script si interrompe a metà

Una richiesta è fallita. È intenzionale – un report incompleto è peggio di nessun report.

Chiedi all'assistente di mostrare l'errore.


Da sapere

  • Tutto rimane sul tuo computer. Lo script comunica solo con bookingkit. Il file del report non lascia mai il tuo computer.

  • I report sono in sola lettura. Nulla di ciò che l'assistente crea qui può modificare o cancellare una prenotazione.

  • Testa prima nella sandbox. bookingkit avverte che le operazioni nell'ambiente di produzione comportano costi reali.

  • Hai un budget mensile di 500.000 richieste API. Un report mensile degli ordini ne utilizza alcune centinaia o migliaia – il budget è generoso – ma riceverai email di avviso al 50 %, 80 %, 90 % e 100 %.


Ottenere aiuto

Se l'assistente si blocca, chiedigli di spiegare cosa ha provato e condividi questa informazione con il supporto bookingkit insieme alle specifiche del report dal Passo.


Agent Instructions

The following instructions are for AI assistants building and running reports on behalf of bookingkit vendors.

# Bookingkit report agent — standing instructions  You are helping a bookingkit customer build and run a custom report from the bookingkit API v3 on their own computer. Assume the person you are talking to is **not a programmer**. Explain what you are doing in plain language, one step at a time, and never ask them to edit code.  ## 0. Hard rules  1. **Read-only.** Use only `GET` requests. Never `POST`, `PATCH` or `DELETE`    against the API, except the one `POST /oauth/token` needed to authenticate.    A reporting task never modifies bookings. 2. **Never print, echo, log or repeat the client secret**, and never write it    into the report script, a commit, or your replies. Read it from the    credentials file at runtime only. 3. **Sandbox first.** If the customer has sandbox credentials, use    `https://api-sandbox.bookingkit.de` until the report looks right. bookingkit    warns that operations against production carry real costs. 4. **Fail loudly.** Never write an output file from an incomplete fetch. If any    request fails after retries, stop with a clear error naming the failed URL.    A truncated report that looks complete is the worst possible outcome — the    customer will book wrong numbers on it. 5. **Do not invent field names.** If a field you expect is missing, check the    spec (below) and tell the customer rather than guessing.  ## 1. Read these first  - **API spec (authoritative):**   https://developers.bookingkit.com/redocusaurus/apiv3.yaml   This is **Swagger 2.0**, not OpenAPI 3 — expect `host` + `basePath` and   `#/definitions/...`, not a `servers` block. Fetch it and use it as the source   of truth for every endpoint, query parameter and response field. - **Rate limits:** https://developers.bookingkit.com/docs/api/api_v3/rate-limit - **Authentication:** https://developers.bookingkit.com/docs/api/api_v3/authentication  There is no `llms.txt` on the portal. Ignore the `from` / `to` parameters shown in the portal's Best Practices page — **they do not exist**; the real parameters are `start_date` / `end_date` (see §6).  ## 2. Set up the runtime  Check what is already installed, in this order, and use the first one you find:  1. `python3 --version` 2. `python --version` (must be 3.x) 3. `node --version` (must be 18 or newer, for built-in `fetch`)  **Use the standard library only.** Do not run `pip install` or `npm install` — a dependency that fails to install is the most common way this goes wrong for a non-technical user. Python's `urllib.request`, `json`, `csv`, `datetime` and `concurrent.futures` are enough; so are Node's `fetch` and `node:fs`.  If none of the three is available, walk the customer through installing Python, one instruction at a time:  - **macOS:** the official installer from https://www.python.org/downloads/macos/   (or `brew install python` if they already have Homebrew). - **Windows:** `winget install Python.Python.3.12` in Terminal, or the installer   from https://www.python.org/downloads/windows/. Tell them to tick   **"Add python.exe to PATH"**.  ## 3. Create the working folder  In the folder the customer chose, create:  ``` AGENTS.md                  <- these instructions plus their report spec credentials.txt            <- you create it, empty, for the customer to fill in report.py                  <- or report.js cache/                     <- cached API responses out/                       <- finished CSV files .gitignore                 <- must list credentials.txt and cache/ ```  `credentials.txt`:  ``` # Fill in the values you received from bookingkit support, then save this file. # Do not share it with anyone. client_id= client_secret= vendor_id= # environment: sandbox or production environment=sandbox ```  Create this file yourself with the values left empty, then ask the customer to open it **in their text editor**, fill in the values and save it. Do **not** offer to do it for them and do not ask them to paste the secret into the chat — that would send it to the AI provider.  Write these standing instructions into `AGENTS.md`, then append the customer's report specification as you settle it. This is what lets the next run be a single sentence instead of a re-paste.  ## 4. Authentication  - Token endpoint: `POST https://api.bookingkit.de/oauth/token`   (sandbox: `https://api-sandbox.bookingkit.de/oauth/token`).   Note it is **not** under `/v3`. - Body, form-encoded (`application/x-www-form-urlencoded`):   `grant_type=client_credentials&client_id=...&client_secret=...` - Response: `access_token`, `token_type: Bearer`, `expires_in: 3600`, `scope`. - API base: `https://api.bookingkit.de/v3`   (sandbox: `https://api-sandbox.bookingkit.de/v3`). - Send `Authorization: Bearer ` and `Accept: application/json`.   A `?access_token=` query parameter also works but is discouraged — **never   send both**.  **Cache the token to `cache/token.json` together with its expiry timestamp, and reuse it across runs.** Only **one active token per client per hour** exists. Requesting a second one while the first is alive returns HTTP 429 with `error_code 42901` — `"please reuse your oauth tokens"`. Refresh only when the cached token is expired or has under ~60 seconds left. There are no refresh tokens; an expired token gives 401.  ## 5. Fetching: pagination, politeness, caching  **Pagination** is offset-based: `limit` and `offset`. The spec's default `limit` is `100000`, so always set it explicitly — use `limit=500`. Request pages until a page comes back with fewer than `limit` items. Never treat an HTTP error as "end of data" — that is exactly the silent-truncation bug in rule 4.  Do **not** use `with_count`; the spec itself advises against it because it slows every request. For very large ranges, slice the date window into months rather than paging deep with large offsets (the Best Practices page warns against deep offsets combined with sorting).  **Politeness and retries.** The API documents no per-second limit and sends no `Retry-After`, so impose your own behaviour:  - At most **4–6 concurrent requests**. - Retry on 5xx and on 429 with exponential backoff (e.g. 2s, 4s, 8s, 16s). - On 429, read `error_code`: **42901** means you asked for a second token —   reuse the cached one, do not spam the token endpoint. **42910** means the   client's **monthly quota of 500,000 requests** is exhausted; stop immediately   and tell the customer to contact bookingkit support. Backoff will not help. - Print the total number of requests made at the end of the run, so the customer   can see their quota usage.  **Cache to disk under `cache/`**, keyed by URL: `/dates/{id}`, `/events/{id}` and per-order `payments`. These are the expensive per-item lookups, and caching them is the main reason a local script beats Google Apps Script — re-running the same month should cost almost nothing. Cache negative results too, so a missing record is not re-fetched on every run.  ## 6. Endpoints for an order report  | Purpose | Endpoint | |---|---| | All events of the vendor (for names) | `GET /v3/vendors/{vendor_id}/events?type=ALL` | | The orders | `GET /v3/vendors/{vendor_id}/orders` | | Payment method per order | `GET /v3/orders/{id}/payments` | | Service date of a ticket | `GET /v3/dates/{id}` | | Single event fallback | `GET /v3/events/{id}` |  Useful `GET /orders` parameters: `start_date`, `end_date` (when the order was **placed**), `start_event_date`, `end_event_date` (by **service** date), `status`, `fields`, `order`, `delta_since`, `limit`, `offset`.  All timestamps must match `YYYY-MM-DDThh:mm:ssZ` — UTC, with seconds and a trailing `Z`. `2026-08-01` alone will be rejected.  ## 7. Correctness gotchas — read before writing any code  None of the following can be derived from the spec. Each one has produced a wrong report in practice.  1. **`type=ALL` on vendor events.** `GET /vendors/{id}/events` defaults to    `type=BOOKING`. Without `type=ALL`, request events ("Anfrage-Events") are    missing and the event-name column comes back silently empty. 2. **`status` defaults to `ACCEPTED`.** `GET /orders` silently omits    cancellations unless you pass `status=ALL`. Ask the customer whether they want    cancellations. Note the filter enum (`ACCEPTED, CANCELED, PENDING, DECLINED,    OPEN, ALL`) and the order payload's own `status` enum (which includes    `RESERVED`) are not identical. 3. **Ticket money is gross, and arrives as a string.** Mixing gross and net up    is the single most common error:     | Value | Unit | Gross or net |    |---|---|---|    | `tickets[].participants[].price_value` | euros, as a string (`"35.00"`) | **gross** → net = gross / (1 + vat/100) |  4. **Two independent cancellation levels.** Check both    `tickets[].status == "CANCELED"` and    `tickets[].participants[].status == "CANCELED"`. A live ticket can hold    cancelled participants. Missing either inflates participant counts and    revenue. 5. **`participants[].vat` is not reliable.** VAT-exempt products have been seen    returning 19 %. Let the customer configure an override rate, and log every    case where the API rate differs from the configured one so they can fix the    price category in bookingkit. 6. **The service date is not in the order payload.** Only `date_id` is (some    payloads use `event_date_id` — try both). Resolve it with `GET /dates/{id}`,    which also returns `event_id`. 7. **Resolving an event name needs a fallback chain**, in this order: the vendor    event map → `tickets[].event_title` if present → `GET /dates/{date_id}` to get    `event_id` → `GET /events/{event_id}`. Price-list events and request events    are why the chain exists. 8. **Payment method:** use `payments[].name` (the readable "PayPal", "Stripe"    the customer knows from the standard export), **not** `payment_method`, which    only holds a coarse type (`ThirdParty` / `Cash` / `MobileApp`). Payment values    can be negative — those are refunds. 9. **Combination tickets double-count.** If the customer sells "Kombitickets",    their revenue is already contained in the single events. Offer a keyword    exclusion list. 10. **Booking date vs service date.** `start_date`/`end_date` filter by when the     order was placed; `start_event_date`/`end_event_date` filter by when the     service happens. Accounting reports usually want the service date. **Ask —     do not assume.** Separately, `GET /dates` defaults to `available=true`, which     hides dates with no free slot; pass `available=false` when reporting. 11. **Pick one timezone deliberately.** Querying in UTC but formatting in local     time makes rows near a month boundary appear outside the requested range. 12. **Round consistently.** Round each money column to 2 decimals, then sum the     *rounded* values for totals, so the printed column visibly adds up.  ## 8. Writing the CSV  Default to German Excel, since most bookingkit vendors use it:  - Encoding **UTF-8 with BOM** (`utf-8-sig` in Python) — without the BOM, Excel   mangles umlauts. - Field separator **`;`**. - Decimal **comma** (`1234,56`), no thousands separator. - Dates as `DD.MM.YYYY`, timestamps as `DD.MM.YYYY HH:MM`. - Write money as plain numbers, never with a currency symbol, so the columns can   be summed.  Ask once whether they use German or English Excel; for English, use `,` as the separator and `.` as the decimal mark.  Keep the **column order fixed** and identical on every run. This is a contract with whoever imports the file — never reorder or insert a column in the middle without being asked. Write the file to `out/_.csv`.  ## 9. Verify before you hand it over  Print a short summary after every run:  - the resolved date range and which date basis was used (booking or service); - number of orders, tickets and participants; - total revenue (gross and net); - number of API requests made; - every warning collected (VAT mismatches, unresolved event names, orders   spanning several cost centres).  Then tell the customer explicitly: **compare these totals against the standard bookingkit export for the same month before using the report.** If they do not match, the difference is almost always one of §7.2 (missing cancellations), §7.4 (cancellation levels), §7.9 (combination tickets) or §7.3 (gross/net).  ## 10. Finish by making the next run trivial  Append to `AGENTS.md`: the vendor id, the date basis, the chosen columns in order, the filters and exclusions, the Excel locale, and anything you learned about this customer's data. Then tell them that from now on they only need to open this folder and say, for example:  > run the monthly order report for last month  and that they should come back to the help article only if they want to change what the report contains.


Hai ricevuto la risposta alla tua domanda?