# API Swagger-Documentation

The documentation of the API is available on `/api/swagger/index.html`

#### Example:

{% tabs %}
{% tab title="Docker" %}

```
docker run -d --name core -p 8080:8080 datarhei/core:latest
```

**Open:** <http://127.0.0.1:8080/api/swagger/index.html>
{% endtab %}

{% tab title="Golang" %}
To generate the API documentation from the code, use [swag](https://github.com/swaggo/swag):

{% code lineNumbers="true" %}

```
make init swagger
make run
```

{% endcode %}

After the first command the swagger definition can be found at `docs/swagger.json` or `docs/swagger.yaml`.

The second command will build the core binary and start it. With the default configuration, the Swagger UI is available at `http://localhost:8080/api/swagger/index.html`.
{% endtab %}
{% endtabs %}

#### Public demo:

{% embed url="<https://demo.datarhei.com/api/swagger/index.html>" %}


---

# Agent Instructions: 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:

```
GET https://docs.datarhei.com/core/api-swagger-documentation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
