> For the complete documentation index, see [llms.txt](https://academy.predium.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.predium.de/api-and-integration-add-on.md).

# API & Integration \[Add-on]

Verbinde Predium mit deinen Systemen. Nutze Gebäudedaten für Auswertungen, Dashboards, Reports und Integrationen.

Die Predium GraphQL API bietet programmatischen Zugriff auf die Gebäudedaten deiner Organisation.

{% hint style="info" %}
**Add-on:** Die API ist nicht im Standardpaket enthalten. Kontaktiere deinen Customer Success Manager für Zugang und weitere Informationen.
{% endhint %}

### Aufgabe

Greife programmatisch auf Gebäudedaten zu. Integriere sie in eigene Auswertungen, Systeme oder automatisierte Reports.

### So geht's

{% stepper %}
{% step %}

#### Zugangsdaten erhalten

Die API ist ein Add-on. Dein Customer Success Manager stellt dir `client_id` und `client_secret` bereit.
{% endstep %}

{% step %}

#### Access Token generieren

Die Authentifizierung läuft über den OAuth 2.0 Client Credentials Grant Flow. Sende einen POST-Request an den Token-Endpunkt:

{% code title="Token-Anfrage" %}

```http
POST /oauth/token HTTP/1.1
Host: auth.predium.de
Content-Type: application/x-www-form-urlencoded

client_id=<YOUR_CLIENT_ID>&
client_secret=<YOUR_CLIENT_SECRET>&
grant_type=client_credentials
```

{% endcode %}

Beispielantwort:

```json
{
 "access_token": "<YOUR_ACCESS_TOKEN>",
 "expires_in": 86400,
 "token_type": "Bearer"
}
```

Die Antwort enthält deinen `access_token`. Er ist 24 Stunden gültig.
{% endstep %}

{% step %}

#### API-Anfragen stellen

Füge den Token bei jeder Anfrage im Header ein:

{% code title="Request-Header" %}

```
Authorization: Bearer <DEIN_ACCESS_TOKEN>
```

{% endcode %}
{% endstep %}

{% step %}

#### API erkunden

Nachdem ein Zugriffstoken erhalten wurde, wird er zur Authentifizierung von API-Anfragen verwendet, indem er in einem [HTTP Authorization request header](https://developer.mozilla.org/docs/Web/HTTP/Headers/Authorization) enthalten ist.

Das HTTP-Header-Format ist `Authorization: Bearer <YOUR_ACCESS_TOKEN>`.

{% code title="Beispielanfrage an die GraphQL API" %}

```http
GET /v1/graphql HTTP/1.1
Host: api.predium.de
Content-Type: application/json; charset=utf-8
Authorization: Bearer <YOUR_ACCESS_TOKEN>

{
	"query": "query Portfolios { portfolio { name } }",
	"variables": null,
	"operationName": "Portfolios"
}
```

{% endcode %}

{% hint style="info" %}
Zum Testen und zur Introspektion der GraphQL API von Predium kannst du die GraphQL-App unter <https://cloud.hasura.io/public/graphiql?endpoint=https://api.predium.de/v1/graphql> verwenden.
{% endhint %}
{% endstep %}
{% endstepper %}

{% hint style="success" %}
Du kannst Predium-Daten nun ohne manuellen Export in eigene Systeme, Dashboards und Workflows integrieren.
{% endhint %}

### Zugriffstoken erneuern

Der Zugriffstoken läuft nach 24 Stunden ab. Die verbleibende Zeit bis zum Ablauf kann durch Decodieren des Zugriffstokens (JWT) abgerufen werden.\
\
Wenn ein Zugriffstoken abgelaufen ist, muss ein neuer Zugriffstoken abgerufen werden. Ein separater Refresh-Token ist nicht erforderlich.

{% hint style="info" %}
Bei Fragen oder wenn du Unterstützung beim Erstellen von Queries und Datenstrukturen benötigst, schicke gerne eine E-Mail an <support@predium.de>.
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://academy.predium.de/api-and-integration-add-on.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
