Tery

API-Dokumentation

Ersetze <kunde> durch deinen Kurznamen (siehe Einstellungen → Widgets). Alle Endpunkte sind öffentlich, liefern nur veröffentlichte Daten und erlauben Aufrufe von jeder Webseite.

REST-API

https://termino.wah.ch/api/public/v1/<kunde>

RSS-Feed

…/v1/<kunde>/events.rss

MCP-Server

https://termino.wah.ch/mcp

Für KI-Assistenten (MCP)

Trage https://termino.wah.ch/mcp in Claude, Cursor oder einem anderen MCP-Client ein. Werkzeuge: list_offerings, get_free_slots, list_events, get_integration_guide. Die Buchung selbst erfolgt über die REST-API im Browser der buchenden Person.

Endpunkte

Alle Pfade hängen an https://termino.wah.ch/api/public/v1/<kunde>. Antworten sind JSON (UTF-8), Zeiten als Epoch-Millisekunden und ISO-8601, Preise in CHF.

GET/offerings

Alle aktiven Gesprächsangebote (1:1-Termine).

Aufruf

curl https://termino.wah.ch/api/public/v1/<kunde>/offerings

Antwort 200

{
  "offerings": [
    { "slug": "erstgespraech", "title": "Erstgespräch", "description": "Kurzes Kennenlernen",
      "duration": 30, "price": 0, "location": "Telefon" }
  ]
}
GET/slots?offering=<slug>

Freie Startzeiten eines Angebots für die nächsten Wochen, Pufferzeiten und Kalender bereits berücksichtigt.

Parameter

  • offering – Slug aus /offerings (optional, sonst das erste aktive Angebot)

Aufruf

curl "https://termino.wah.ch/api/public/v1/<kunde>/slots?offering=erstgespraech"

Antwort 200

{
  "offering": { "slug": "erstgespraech", "title": "Erstgespräch", "duration": 30, "price": 0, "location": "Telefon" },
  "slots": [
    { "start": 1767600000000, "iso": "2026-01-05T08:00:00.000Z" }
  ]
}
GET/events

Kommende veröffentlichte Workshops und Webinare.

Aufruf

curl https://termino.wah.ch/api/public/v1/<kunde>/events

Antwort 200

{
  "events": [
    { "id": 12, "kind": "workshop", "title": "Atem & Ruhe", "date": "2026-12-01", "time": "19:00",
      "place": "Jona", "price": "CHF 22.–", "text": "…", "full": false, "image": "…" }
  ]
}
GET/events.rss

Dieselben Veranstaltungen als RSS-2.0-Feed (für Newsletter-Tools, Zapier, Feedreader).

Aufruf

curl https://termino.wah.ch/api/public/v1/<kunde>/events.rss

Antwort 200 (application/rss+xml)

<rss version="2.0"><channel>
  <title>Veranstaltungen – kunde</title>
  <item><title>Atem &amp; Ruhe – 01.12.2026, 19:00</title> … </item>
</channel></rss>
GET/challenge?purpose=call|registration

Holt eine Sicherheitsaufgabe für eine Buchung (call) oder Workshop-Anmeldung (registration).

Parameter

  • purpose – call oder registration

Aufruf

curl "https://termino.wah.ch/api/public/v1/<kunde>/challenge?purpose=call"

Antwort 200

{ "challenge": "eyJwdXJwb3Nl….9f3a…", "rule": "find integer n so that sha256(...) starts with '000' ..." }
POST/book

Bucht einen freien Termin. Ist das Angebot kostenpflichtig und Stripe eingerichtet, kommt ein Zahlungslink zurück.

Parameter

  • offering – Slug
  • start – Startzeit aus /slots (Epoch ms)
  • name, email – Pflicht
  • phone, note – optional
  • consent – true (Datenschutz akzeptiert)
  • website – leer lassen
  • proof – { challenge, solution }

Aufruf

curl -X POST https://termino.wah.ch/api/public/v1/<kunde>/book -H "Content-Type: application/json" -d '{
  "offering": "erstgespraech", "start": 1767600000000,
  "name": "Anna Muster", "email": "[email protected]", "consent": true,
  "website": "", "proof": { "challenge": "…", "solution": 4711 } }'

Antwort 201

{ "ok": true, "status": "aktiv", "checkoutUrl": null }
// oder bei Bezahlung: { "ok": true, "status": "zahlung offen", "checkoutUrl": "https://checkout.stripe.com/…" }
POST/events/<id>/register

Meldet eine Person für einen Workshop oder ein Webinar an. Ist er voll, landet sie auf der Warteliste.

Parameter

  • id – aus /events
  • name, email – Pflicht
  • phone, note – optional
  • consent, website, proof – wie bei /book (purpose=registration)

Aufruf

curl -X POST https://termino.wah.ch/api/public/v1/<kunde>/events/12/register -H "Content-Type: application/json" -d '{
  "name": "Anna Muster", "email": "[email protected]", "consent": true,
  "website": "", "proof": { "challenge": "…", "solution": 815 } }'

Antwort 201

{ "ok": true, "status": "bestätigt", "checkoutUrl": null }
// status: "bestätigt" | "neu" (Bezahlung vor Ort) | "zahlung offen" (mit checkoutUrl) | "warteliste"

Sicherheitsaufgabe lösen

Schreibende Aufrufe brauchen eine gelöste Aufgabe (statt Captcha): Suche die kleinste ganze Zahl n, bei der sha256("<challenge>:n") als Hex mit 000 beginnt. Sende frühestens 2 Sekunden nach dem Abholen; jede Aufgabe gilt nur einmal. Das Feld website ist eine Falle für Bots und muss leer bleiben.

async function solve(challenge) {
  for (let n = 0; ; n++) {
    const h = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(challenge + ":" + n));
    const hex = [...new Uint8Array(h)].map((b) => b.toString(16).padStart(2, "0")).join("");
    if (hex.startsWith("000")) return n;
  }
}

Fehler

Kurzfassung für KI-Assistenten (Markdown)
# Tery Headless API (v1)

Base: https://termino.wah.ch/api/public/v1/<kunde>
CORS open (`*`), JSON only. Build native UI in the host site's design; no iframe needed.

## Read
- GET /offerings → { offerings: [{ slug, title, description, duration, price, location }] }
- GET /slots?offering=<slug> → { offering, slots: [{ start (epoch ms), iso }] }
- GET /events → { events: [{ id, kind, title, date, time, place, price, full, ... }] }
- GET /events.rss → RSS 2.0 feed of upcoming events (feed readers, newsletter tools, Zapier/Make)

## Write (bot-protected)
1. GET /challenge?purpose=call|registration → { challenge }
2. Find integer n ≥ 0 with sha256(`${challenge}:${n}`) hex starting with "000" (Web Crypto, a few ms). Submit ≥ 2 s after fetching; each challenge works once.
3. Send `proof: { challenge, solution: n }`, `website: ""` (honeypot, keep empty and hidden), `consent: true`.

- POST /book  { offering, start, name, email, phone?, note?, consent, website, proof } → 201 { ok, status, checkoutUrl }
- POST /events/<id>/register  { name, email, phone?, note?, consent, website, proof } → 201 { ok, status, checkoutUrl }
If checkoutUrl is set, redirect there for payment. Errors: { error } with 400/404/422.

## React recipe
```ts
const API = "https://termino.wah.ch/api/public/v1/<kunde>";
async function solve(challenge: string) {
  for (let n = 0; ; n++) {
    const h = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(`${challenge}:${n}`));
    const hex = [...new Uint8Array(h)].map((b) => b.toString(16).padStart(2, "0")).join("");
    if (hex.startsWith("000")) return n;
  }
}
export async function book(offering: string, start: number, person: { name: string; email: string; phone?: string; note?: string }) {
  const { challenge } = await (await fetch(`${API}/challenge?purpose=call`)).json();
  const solution = await solve(challenge);
  const r = await fetch(`${API}/book`, { method: "POST", headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ offering, start, ...person, consent: true, website: "", proof: { challenge, solution } }) });
  const data = await r.json(); if (!r.ok) throw new Error(data.error); return data;
}
```
Fetch the challenge when the form opens (so 2 s have passed at submit). Show times in Europe/Zurich, prices in CHF, a required consent checkbox linking the host's privacy policy.