> For the complete documentation index, see [llms.txt](https://docs.kiloiot.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kiloiot.io/kilo-docs-de/kilo-iot-server/api/authentication-and-api-keys.md).

# Authentifizierung & API-Keys

Authentifizieren Sie Kilo-IoT-API-Anfragen mit bereichsbezogenen Schlüsseln — X-API-Key- und X-Organization-Id-Header, Schlüssel pro Integration.

Jede API-Anfrage — REST oder gRPC — wird authentifiziert mit einem **API-Schlüssel mit Geltungsbereich**. Erstellen, beschränken, rotieren und widerrufen Sie Schlüssel in [Einstellungen → API-Schlüssel](/kilo-docs-de/kilo-iot-server/settings/api-keys.md); diese Seite beschreibt, wie sich Anfragen authentifizieren.

## Wie sich Anfragen authentifizieren

* **`X-API-Key`** — Ihr API-Schlüssel (Format `kilo_<key>`). Senden Sie ihn bei jeder Anfrage.
* **`X-Organization-Id`** — die Organisation, in deren Kontext die Anfrage ausgeführt wird. Sie muss mit der Organisation übereinstimmen, in der der Schlüssel erstellt wurde. Einige Vorgänge akzeptieren die Organisation auch als `organizationId` Abfrageparameter anstelle des Headers.

Alle Anfragen erfolgen über TLS.

## Berechtigungsbereiche

Schlüssel sind bereichsbezogen. Die meisten Bereiche haben separate **Lese** und **Schreib** Berechtigungen; einige — wie Telemetrie und Abonnementdaten — sind schreibgeschützt. Ein Schlüssel gewährt nur das, was Sie bei der Erstellung auswählen; gewähren Sie also nur die Berechtigungen, die die Integration benötigt. Jeder Endpunkt in der [API-Referenz](https://api.kiloiot.io/) führt die erforderliche Berechtigung auf.

Die **API-Schlüssel erstellen** Der Dialog fragt nach einem Namen, einem optionalen Ablaufdatum und den Berechtigungen selbst — jede Berechtigung ist zunächst nicht ausgewählt, sodass ein Schlüssel nichts gewährt, bis Sie es festlegen.

<figure><img src="https://895787959-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtNQh1wBSHSaknslMdOXm%2Fuploads%2Fgit-blob-e2e31de97adacb0b0d949199c29378c195801c26%2Fapi-key-create-scopes.jpg?alt=media" alt="The Create API Key dialog with the name and expiry fields above the list of read and write scopes"><figcaption></figcaption></figure>

## Sicherer Umgang mit Schlüsseln

* Der vollständige Schlüsselwert wird angezeigt **einmal** bei der Erstellung; danach ist nur noch ein kurzer Präfix sichtbar. Speichern Sie ihn sofort in einem Secrets-Manager oder Tresor.
* Verwenden Sie einen **separaten Schlüssel pro Integration** damit einer widerrufen werden kann, ohne die anderen zu beeinträchtigen.
* **Rotieren oder widerrufen Sie** einen Schlüssel sofort, wenn er möglicherweise offengelegt wurde; die Rotation ist der einzige Wiederherstellungsweg für einen verlorenen Schlüssel.
* Betten Sie einen Schlüssel niemals in clientseitigen Code ein und committen Sie ihn nicht in die Versionskontrolle.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kiloiot.io/kilo-docs-de/kilo-iot-server/api/authentication-and-api-keys.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
