# For AI agents

Coding agents such as Claude Code, Codex or Cursor add the subscribe button or a whole integration in minutes when they have the right sources.

## Copy-prompt: add the button

Replace the calendar id and give the prompt to your agent:

```text
Add a subscribe button for my calendar cal_XXXXXXXXXXXX to my website.

Use this snippet from Kalender Sync:
<div class="ks-subscribe" data-calendar="cal_XXXXXXXXXXXX"></div>
<script src="https://app.kalender-sync.de/embed/v1/button.js" async></script>

- Place the button where visitors see our events.
- Match the color to our brand color with data-color="#rrggbb".
- Include the script only once per page.
- If the site has a Content Security Policy, allow script-src https://app.kalender-sync.de.
- If the site renders content later (SPA, page builder), call window.KalenderSync?.mountButtons() afterwards.
- If we use our own analytics, track clicks through the ks:subscribe event (event.detail.app).

Docs: https://docs.kalender-sync.de/en/api/button/
```

## Copy-prompt: build an integration

```text
Build an integration that sends our events to the Kalender Sync Publisher API.

- OpenAPI: https://api.kalender-sync.de/v1/openapi.json
- Docs: https://docs.kalender-sync.de/en/api/ (Markdown: page URL without the trailing slash plus .md)
- Authentication: Authorization: Bearer <API key>. Store the key server side only, never in the frontend.
- Write events with PUT /v1/publisher/calendars/{calendar_id}/events/{external_id}; external_id is our own id.
- On delete or unpublish, DELETE the same path.
- Use the full sync for the first import and a daily reconciliation (syncs, batch with sync_id, complete).
- Errors are application/problem+json; branch on "code", not on "detail".
- On 429, respect the Retry-After header.
- Test with a sandbox key (ks_test_) first.
```

## Sources for agents

- **OpenAPI 3.1:** [https://api.kalender-sync.de/v1/openapi.json](https://api.kalender-sync.de/v1/openapi.json), public, no key.
- **Every docs page as Markdown:** append `.md` to the URL without the trailing slash, for example `https://docs.kalender-sync.de/en/api/events.md`. Every page also has "Copy Markdown" at the top.
- **Everything at once:** [llms.txt](https://docs.kalender-sync.de/llms.txt) and [llms-full.txt](https://docs.kalender-sync.de/llms-full.txt).
- **Error codes:** the `type` field of every error response links straight to the matching explanation. → [Errors](https://docs.kalender-sync.de/en/api/errors/)

## Subscribe calendars through MCP

Through the Kalender Sync MCP server, your AI assistant maintains subscribe calendars without an API key. How to connect an assistant: [Connect an AI assistant](https://docs.kalender-sync.de/en/ki-assistent/).

- **Unlock:** when connecting, actively tick **“Manage subscribe calendars (optional)”**. It is never preselected. If your assistant is already connected, reconnect it once and tick the box; existing connections never get this permission automatically. This works with Claude and ChatGPT (including Claude Code and Codex). Clients with an access key use the Publisher API instead.
- **Tools:** `list_publisher_calendars`, `create_publisher_calendar`, `update_publisher_calendar`, `write_publisher_events` (up to 100 events per call, result per event), `list_publisher_events`, `get_publisher_stats` and `get_subscribe_button`.
- **Test mode and live:** the assistant creates new calendars in test mode. It creates a live calendar only when you explicitly want it, from Basic on and after your one-time consent to the additional terms. Without it you get [`terms_required`](https://docs.kalender-sync.de/en/api/errors/terms_required/) with the link to the settings.
- **Deleting:** the assistant can delete events, not a whole calendar. That only works through the API.
- **Cost:** the tools cost no credits.