# EmergencyOS Endpoints

{% hint style="info" %}
Beachte, dass das Addon Datenbank Sync aktiviert sein muss
{% endhint %}

Um die Funktionen der API zu nutzen, ist es erforderlich, dass du bei bestimmten Events Anfragen an EmergencyOS sendest.

## Setup&#x20;

Es ist Ihnen vollständig überlassen, von wo und wie Sie Anfragen an die API senden, solange sie der Dokumentation entsprechen.

## Endpoints

Bevor Sie eine Anfrage an die API senden, müssen Sie Ihre Instance ID ermitteln. Dies ist einmalig pro Server/Script-Start erforderlich. Mit dieser Instance ID müssen Sie dann jede weitere Anfrage validieren.

## Get your instance id

<mark style="color:blue;">`GET`</mark> `https://emergencyos.de/api/getInstance`

With this endpoint you can get the InstanceID for your account with which all further requests must be signed

#### Headers

| Name                                                | Type   | Description                     |
| --------------------------------------------------- | ------ | ------------------------------- |
| API-KEY<mark style="color:red;">\*</mark>           | string | Your EmergncyOS API Key         |
| INSTANCE-USERNAME<mark style="color:red;">\*</mark> | string | Your EmergencyOS admin username |
| INSTANCE-PASSWORD<mark style="color:red;">\*</mark> | string | Your EmergencyOS admin password |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
{
    instanceId: number, // You instance id
}
```

{% endtab %}

{% tab title="203: Non-Authoritative Information Error while reqest" %}

```javascript
{
    string errorMessage //ErrorMessage with more information
}
```

{% endtab %}
{% endtabs %}

Dieser Endpoint sollte aufgerufen werden, sobald ein Spieler eine Rechnung auf dem Server bezahlt hat. Falls die Rechnungs-ID mit einem Ticket verknüpft ist, wird dieses automatisch als "bezahlt" markiert.

## Set a bill as payed in EmergencyOS

<mark style="color:green;">`POST`</mark> `https://emergencyos.de/api/billPayed`

Reports a paid invoice to EmergencyOS and if a ticket exists for this invoice, it will be marked as paid

#### Headers

| Name                                          | Type   | Description             |
| --------------------------------------------- | ------ | ----------------------- |
| API-KEY<mark style="color:red;">\*</mark>     | string | Your EmergncyOS API key |
| INSTANCE-ID<mark style="color:red;">\*</mark> | number | Your instance id        |

#### Request Body

| Name                                     | Type   | Description           |
| ---------------------------------------- | ------ | --------------------- |
| billId<mark style="color:red;">\*</mark> | string | The id of the invoice |

{% tabs %}
{% tab title="200: OK Reqest success" %}

```javascript
```

{% endtab %}

{% tab title="401: Unauthorized Not successfully authorized" %}

```javascript
```

{% endtab %}

{% tab title="400: Bad Request Error with the reqest" %}

```javascript
{
    string errorMessage // Contains more Info about why the reqest failed
}
```

{% endtab %}
{% endtabs %}


---

# 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.emergencyos.de/api/api/emergencyos-endpoints.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.
