# API

> 💡 **Python-Entwickler:** Verwenden Sie das offizielle [clore-ai Python SDK](/clore.ai/clore.ai-eng-de/entwickler/python-sdk.md) anstatt direkter API-Aufrufe. Es kümmert sich automatisch um Authentifizierung, Ratenbegrenzung, Wiederholungen und Fehlerbehandlung.
>
> **Schnellstart:** `pip install clore-ai` — Siehe die [Python SDK-Dokumentation](/clore.ai/clore.ai-eng-de/entwickler/python-sdk.md) und [CLI-Referenz](/clore.ai/clore.ai-eng-de/entwickler/cli-guide.md).

<div data-full-width="true"><figure><img src="/files/df2f0042c212d9e419290294aae60bfccfb6a2c5" alt=""><figcaption></figcaption></figure></div>

### Einführung <a href="#introduction" id="introduction"></a>

[CLORE.AI](http://clore.ai/) API kann verwendet werden, um die Bereitstellung Ihrer Workloads auf [CLORE.AI](http://clore.ai/)

Zuerst müssen Sie einen API-Schlüssel erhalten\
![alt text](https://clore.ai/assets/html/api-export1.png)\
![alt text](https://clore.ai/assets/html/api-export2.png)

***

### API-Antworten <a href="#api-responses" id="api-responses"></a>

Antworten werden im JSON-Format zurückgegeben, können unterschiedliche Felder enthalten

Immer zurückgegebenes Feld ist code, das den Status angibt

**code-Feld**

| code | Beschreibung                              |
| ---- | ----------------------------------------- |
| `0`  | NORMAL                                    |
| `1`  | DATENBANKFEHLER                           |
| `2`  | UNGÜLTIGE EINGABEDATEN                    |
| `3`  | UNGÜLTIGES API-TOKEN                      |
| `4`  | UNGÜLTIGER ENDPUNKT                       |
| `5`  | LIMIT VON 1 ANFRAGE/SEKUNDE ÜBERSCHRITTEN |
| `6`  | Fehler angegeben in `error` Feld          |

***

### Endpunkte <a href="#endpoints" id="endpoints"></a>

#### 1. `Wallets` <a href="#id-1-wallets" id="id-1-wallets"></a>

**Über**

Gibt Wallets und Guthaben zurück

**Header**

| Feld   | Typ      | Pflichtfeld | Beschreibung |
| ------ | -------- | ----------- | ------------ |
| `auth` | `string` | Ja          | API-Token    |

**Ausgabe**

| Feld      | Typ        | Beschreibung      |
| --------- | ---------- | ----------------- |
| `code`    | `int`      | Statuscode        |
| `Wallets` | `[]string` | Array von Wallets |

**Beispiel**

**Eingabe:**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/wallets'
```

**Ausgabe:**

```
{
  "wallets": [
    {
      "name": "bitcoin",
      "deposit": "tb1q6erw7v02t7hakgmlcl4wfnlykzqj05alndruwr",
      "balance": 0.00153176,
      "withdrawal_fee": 0.0001
    }
  ],
  "code": 0
}
```

#### 2. `my_servers` <a href="#id-2-my_servers" id="id-2-my_servers"></a>

**Über**

Gibt Ihre Server zurück, die Sie auf [clore.ai](http://clore.ai/) Marktplatz bereitstellen

**Header**

| Feld   | Typ      | Pflichtfeld | Beschreibung |
| ------ | -------- | ----------- | ------------ |
| `auth` | `string` | Ja          | API-Token    |

**Ausgabe**

| Feld                          | Typ        | Beschreibung                                          |
| ----------------------------- | ---------- | ----------------------------------------------------- |
| `code`                        | `int`      | Statuscode                                            |
| `Limit`                       | `int`      | Maximale Anzahl Server, die Sie besitzen können       |
| `Server`                      | `[]string` | Array von Servern                                     |
| `servers[x].name`             | `string`   | Vom Benutzer gewählter Servername                     |
| `servers[x].connected`        | `string`   | Ob der Server jemals mit [clore.ai](http://clore.ai/) |
| `servers[x].visibility`       | `string`   | Sichtbarkeit auf dem Marktplatz                       |
| `servers[x].pricing`          | `[]string` | Preis/Tag On-Demand                                   |
| `servers[x].online`           | `bool`     | Ist der Server online                                 |
| `servers[x].min_spot_pricing` | `[]string` | Minimaler Preis/Tag für Vermietung auf dem Spot-Markt |
| `servers[x].init_token`       | `string`   | Initialisierungstoken                                 |
| `servers[x].specs`            | `[]string` | Server-Spezifikationen                                |

**Beispiel**

**Eingabe:**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/my_servers'
```

**Ausgabe:**

```
{
  "servers": [
    {
      "name": "Michael",
      "connected": false,
      "visibility": "hidden",
      "pricing": { "bitcoin": 0, "usd": 0 },
      "online": false,
      "min_spot_pricing": { "bitcoin": 0, "usd": 0 },
      "init_token": "qnwVIMsZPjUWS7jw6gAbTOeoGQNgTH9XVxJaiCEbG0OlmfjF"
    },
    {
      "name": "Jan Vykydal",
      "connected": true,
      "visibility": "public",
      "pricing": { "bitcoin": 0.00010337, "usd": 0 },
      "online": false,
      "min_spot_pricing": { "bitcoin": 0.00005168, "usd": 0 },
      "specs": {
        "mb": "Z590 GAMING X",
        "cpu": "Intel Core i9-11900",
        "cpus": "8/16",
        "ram": 64,
        "disk": "NVMe 512GB",
        "disk_speed": 2000,
        "gpu": "1x GeForce GTX 1080 Ti",
        "gpuram": 11,
        "net": {
          "down":119.61,
          "up":25.24
        }
      }
    }
  ],
  "limit": 16,
  "code": 0
}
```

**\*USD noch nicht implementiert**

#### 3. `server_config` <a href="#id-3-server_config" id="id-3-server_config"></a>

**Über**

Konfiguration eines bestimmten Servers abrufen

**Header**

| Feld           | Typ      | Pflichtfeld | Beschreibung                 |
| -------------- | -------- | ----------- | ---------------------------- |
| `auth`         | `string` | Ja          | API-Token                    |
| `Content-Type` | `string` | Ja          | Muss sein `application/json` |

**Body**

| Feld          | Typ      | Pflichtfeld | Beschreibung |
| ------------- | -------- | ----------- | ------------ |
| `server_name` | `string` | Ja          | Servername   |

**Ausgabe**

| Feld                    | Typ        | Beschreibung                                                                   |
| ----------------------- | ---------- | ------------------------------------------------------------------------------ |
| `code`                  | `int`      | Statuscode                                                                     |
| `creation_completed`    | `bool`     | Ist die Servererstellung abgeschlossen                                         |
| `config`                | `[]string` | Konfiguration des Servers                                                      |
| `config.name`           | `string`   | Vom Benutzer gewählter Servername                                              |
| `config.connected`      | `bool`     | Ob der Server jemals mit [clore.ai](http://clore.ai/)                          |
| `config.visibility`     | `string`   | Sichtbarkeit auf dem Marktplatz                                                |
| `config.pricing`        | `[]string` | Preis/Tag On-Demand                                                            |
| `config.spot_pricing`   | `[]string` | Minimaler Preis/Tag für Vermietung auf dem Spot-Markt                          |
| `config.mrl`            | `int`      | Maximale Mietdauer in Stunden                                                  |
| `config.online`         | `bool`     | Ist der Server online                                                          |
| `config.initialized`    | `bool`     | Ob der Server jemals mit [clore.ai](http://clore.ai/)                          |
| `config.id`             | `int`      | Eindeutige Server-ID                                                           |
| `config.rental_status`  | `int`      | 0 - nicht vermietet \| 1 - Auf Spot-Markt vermietet \| 2 - On-Demand vermietet |
| `config.specs`          | `[]string` | Server-Spezifikationen                                                         |
| `config.background_job` | `[]string` | Hintergrundaufgabe, wenn nicht vermietet                                       |

**Beispiel**

**Eingabe:**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "server_name":"Jan Vykydal"
}' 'https://api.clore.ai/v1/server_config'
```

**Ausgabe:**

```
{
  "config": {
    "name": "Jan Vykydal",
    "connected": true,
    "visibility": "public",
    "pricing": { "bitcoin": 0.00010337, "usd": 0 },
    "spot_pricing": { "bitcoin": 0.00005168, "usd": 0 },
    "mrl": 72,
    "online": false,
    "initialized": true,
    "id": 4,
    "rental_status": 0,
    "specs": {
      "mb": "Z590 GAMING X",
      "cpu": "Intel Core i9-11900",
      "cpus": "8/16",
      "ram": 64,
      "disk": "NVMe 512GB",
      "disk_speed": 2000,
      "gpu": "1x GeForce GTX 1080 Ti",
      "gpuram": 11,
      "net": {
        "down":119.61,
        "up":25.24
      }
    },
    "background_job": {
      "times_updated": 1,
      "image": "cloreai/ubuntu20.04-jupyter",
      "command": "",
      "env": []
    }
  },
  "creation_completed": true,
  "code": 0
}
```

**\*USD noch nicht implementiert**

#### 4. `Marktplatz bereitstellen` <a href="#id-4-marketplace" id="id-4-marketplace"></a>

**Über**

Marktplatz abrufen

**Header**

| Feld   | Typ      | Pflichtfeld | Beschreibung |
| ------ | -------- | ----------- | ------------ |
| `auth` | `string` | Ja          | API-Token    |

**Ausgabe**

| Feld                         | Typ        | Beschreibung                                                                                             |
| ---------------------------- | ---------- | -------------------------------------------------------------------------------------------------------- |
| `code`                       | `int`      | Statuscode                                                                                               |
| `my_servers`                 | `[]string` | Array von Server-IDs, die Sie bereitstellen [clore.ai](http://clore.ai/) (können nicht vermietet werden) |
| `Server`                     | `[]string` | Array öffentlicher Server auf dem Marktplatz                                                             |
| `servers[x].id`              | `int`      | Eindeutige Server-ID                                                                                     |
| `servers[x].owner`           | `int`      | Eindeutige Besitzer-ID                                                                                   |
| `servers[x].mrl`             | `int`      | Maximale Mietdauer in Stunden                                                                            |
| `servers[x].price.on_demand` | `[]string` | On-Demand-Preis pro Tag                                                                                  |
| `servers[x].spot`            | `[]string` | Minimaler Spot-Markt-Preis pro Tag                                                                       |
| `servers[x].rented`          | `bool`     | Ist der Server On-Demand vermietet                                                                       |
| `servers[x].specs`           | `[]string` | Server-Spezifikationen                                                                                   |

**Beispiel**

Marktplatz abrufen

**Eingabe:**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/marketplace'
```

**Ausgabe:**

```
{
  "servers": [
    {
      "id": 6,
      "owner": 4,
      "mrl": 73,
      "price": { "on_demand": { "bitcoin": 0.00001 },
      "spot": { "bitcoin": 0.000001 }},
      "rented": false,
      "specs": {
        "mb": "Z590 GAMING X",
        "cpu": "11th Gen Intel(R) Core(TM) i9-11900 @ 2.50GHz",
        "cpus": "8/16",
        "ram": 62.67348861694336,
        "disk": "NVMe disk 247.3623046875GB",
        "disk_speed": 0,
        "gpu": "1x NVIDIA GeForce GTX 1080 Ti",
        "gpuram": 11,
        "net": {
          "up": 26.38,
          "down": 118.42,
          "cc": "CZ"
        }
      }
    }
  ],
  "my_servers": [1, 2, 4],
  "code": 0
}
```

#### 5. `my_orders` <a href="#id-5-my_orders" id="id-5-my_orders"></a>

**Über**

Ihre Bestellungen abrufen

**Header**

| Feld   | Typ      | Pflichtfeld | Beschreibung |
| ------ | -------- | ----------- | ------------ |
| `auth` | `string` | Ja          | API-Token    |

**Abfragezeichenfolge**

| Feld               | Typ    | Pflichtfeld | Beschreibung                                      |
| ------------------ | ------ | ----------- | ------------------------------------------------- |
| `return_completed` | `bool` | Nein        | Vollendete (abgelaufene) Bestellungen zurückgeben |

**Ausgabe**

| Feld                     | Typ        | Beschreibung                                              |
| ------------------------ | ---------- | --------------------------------------------------------- |
| `code`                   | `int`      | Statuscode                                                |
| `Limit`                  | `int`      | Maximale Anzahl aktiver Bestellungen                      |
| `orders`                 | `[]string` | Array von Bestellungen                                    |
| `orders[x].id`           | `int`      | Eindeutige Bestell-ID                                     |
| `orders[x].fee`          | `float`    | Gebühr (%) bezahlt an [clore.ai](http://clore.ai/)        |
| `orders[x].creation_fee` | `float`    | Erstellungsgebühr bezahlt an [clore.ai](http://clore.ai/) |
| `orders[x].price`        | `float`    | Bestellpreis (Kosten) pro Tag                             |
| `orders[x].mrl`          | `int`      | Maximale Mietdauer der Bestellung in Sekunden             |
| `orders[x].image`        | `string`   | Verwendetes Docker-Image                                  |
| `orders[x].currency`     | `string`   | Zur Abrechnung verwendete Währung                         |
| `orders[x].spend`        | `float`    | Für die Bestellung ausgegebener Betrag                    |
| `orders[x].ct`           | `int`      | Erstellungszeit (UNIX-Zeit)                               |
| `orders[x].p`            | `int`      | Derzeit verwendeter Proxy-Cluster                         |
| `orders[x].specs`        | `[]string` | Server-Spezifikationen                                    |
| `orders[x].si`           | `int`      | Eindeutige Server-ID                                      |
| `orders[x].pub_cluster`  | `[]string` | Öffentliche Endpunkte mit weitergeleiteten Ports          |
| `orders[x].tcp_ports`    | `[]string` | TCP-Portweiterleitung                                     |
| `orders[x].http_port`    | `string`   | Container-Port, der über HTTPS-Proxy weitergeleitet wird  |
| `orders[x].spot`         | `bool`     | Angabe, dass es sich um eine Spot-Bestellung handelt      |
| `orders[x].expired`      | `bool`     | Angabe, dass die Bestellung abgelaufen ist                |

**Eingabe:**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/my_orders?return_completed=true'
```

**Ausgabe:**

```
{
  "orders": [
    {
      "id": 38,
      "fee": 5,
      "creation_fee": 3e-7,
      "price": 0.00001,
      "mrl": 262800,
      "image": "cloreai/ubuntu20.04-jupyter",
      "currency": "bitcoin",
      "spend": 6.944444444444445e-9,
      "ct": 1667401396,
      "p": 1,
      "specs": {
        "mb": "Z590 GAMING X",
        "cpu": "11th Gen Intel(R) Core(TM) i9-11900 @ 2.50GHz",
        "cpus": "8/16",
        "ram": 62.67348861694336,
        "disk": "NVMe disk 247.3623046875GB",
        "disk_speed": 2000,
        "gpu": "1x NVIDIA GeForce GTX 1080 Ti",
        "gpuram": 11,
        "net": {
          "up": 26.38,
          "down": 118.42,
        }
      },
      "si": 6,
      "pub_cluster": [ "n1.c1.clorecloud.net", "n2.c1.clorecloud.net" ],
      "tcp_ports": [ "22:10000" ],
      "http_port": "8888"
    },{
      "id": 36,
      "fee": 2.5,
      "creation_fee": 1e-7,
      "price": 0.00001,
      "mrl": 262800,
      "image": "cloreai/ubuntu20.04-jupyter",
      "currency": "bitcoin",
      "spend": 1.3888888888888888e-7,
      "ct": 1667248597,
      "specs": {
        "mb": "Z590 GAMING X",
        "cpu": "11th Gen Intel(R) Core(TM) i9-11900 @ 2.50GHz",
        "cpus": "8/16",
        "ram": 62.67348861694336,
        "disk": "NVMe disk 247.3623046875GB",
        "disk_speed": 2000,
        "gpu": "1x NVIDIA GeForce GTX 1080 Ti",
        "gpuram": 11,
        "net": {
          "up": 26.38,
          "down": 118.42,
        }
      },
      "si": 6,
      "spot": true,
      "expired": true,
      "tcp_ports": []
    }
  ],
  "limit": 13,
  "code": 0
}
```

#### 6. `spot_marketplace` <a href="#id-6-spot_marketplace" id="id-6-spot_marketplace"></a>

**Über**

Spot-Marktplatz für einen bestimmten Server abrufen

**Header**

| Feld   | Typ      | Pflichtfeld | Beschreibung |
| ------ | -------- | ----------- | ------------ |
| `auth` | `string` | Ja          | API-Token    |

**Abfragezeichenfolge**

| Feld     | Typ   | Pflichtfeld | Beschreibung         |
| -------- | ----- | ----------- | -------------------- |
| `market` | `int` | Ja          | Eindeutige Server-ID |

**Ausgabe**

| Feld                        | Typ      | Beschreibung                                                            |
| --------------------------- | -------- | ----------------------------------------------------------------------- |
| `code`                      | `int`    | Statuscode                                                              |
| `exists`                    | `bool`   | Prüfung, dass der Markt existiert                                       |
| `market`                    | `Objekt` | Marktplatz                                                              |
| `market.offers`             | `Array`  | Mietangebote für den Server                                             |
| `market.offers[x].offer_id` | `int`    | Eindeutige Angebots-ID                                                  |
| `market.offers[x].bid`      | `float`  | Angebotener Preis pro Tag                                               |
| `market.offers[x].active`   | `bool`   | Dieses Angebot wird derzeit verwendet                                   |
| `market.offers[x].my`       | `bool`   | Dieses Angebot gehört mir                                               |
| `market.server`             | `Objekt` | Serverinformationen                                                     |
| `market.server.min_pricing` | `Objekt` | Minimaler Angebots-Preis pro Tag                                        |
| `market.server.mrl`         | `int`    | Maximale Mietdauer in Sekunden                                          |
| `market.server.visibility`  | `string` | Sie können nur Angebote erstellen, wenn die Sichtbarkeit öffentlich ist |
| `market.server.online`      | `bool`   | Server ist online                                                       |

**Eingabe:**

```
curl -XGET -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' 'https://api.clore.ai/v1/spot_marketplace?market=6'
```

**Ausgabe:**

```
{
  "market": {
    "offers": [
      {
        "offer_id": 39,
        "bid": 0.0000042,
        "active": true,
        "my": true
      }
    ],
    "server": {
      "min_pricing": {
        "bitcoin": 0.000001
      },
      "mrl": 262800,
      "visibility": "public",
      "online": true
    }
  },
  "exists": true,
  "code": 0
}
```

#### 7. `set_server_settings` <a href="#id-7-set_server_settings" id="id-7-set_server_settings"></a>

**Über**

Einstellungen des Servers konfigurieren, den Sie auf [clore.ai](http://clore.ai/) Marktplatz bereitstellen

**Header**

| Feld           | Typ      | Pflichtfeld | Beschreibung                 |
| -------------- | -------- | ----------- | ---------------------------- |
| `auth`         | `string` | Ja          | API-Token                    |
| `Content-Type` | `string` | Ja          | Muss sein `application/json` |

**Body**

| Feld            | Typ      | Pflichtfeld | Beschreibung                             |
| --------------- | -------- | ----------- | ---------------------------------------- |
| `name`          | `string` | Ja          | Vom Benutzer gewählter Servername        |
| `Verfügbarkeit` | `bool`   | Ja          | Kann der Server gemietet werden          |
| `mrl`           | `int`    | Ja          | Maximale Mietdauer des Servers           |
| `on_demand`     | `float`  | Ja          | Preis pro Tag für Ihren Server On-Demand |
| `spot`          | `float`  | Ja          | Minimaler Preis pro Tag für SPOT-Angebot |

**Ausgabe**

| Feld   | Typ   | Beschreibung |
| ------ | ----- | ------------ |
| `code` | `int` | Statuscode   |

**Beispiel**

Lassen Sie uns einen Sende-Nachweis für eine Transaktion erstellen, die aus der aktuellen Wallet gesendet wurde.

**Eingabe:**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "name": "Jan Vykydal",
    "availability":true,
    "mrl":96,
    "on_demand":0.0001,
    "spot":0.00000113
}' 'https://api.clore.ai/v1/set_server_settings'
```

**Ausgabe:**

```
{
  "code": 0
}
```

#### 8. `set_spot_price` <a href="#id-8-set_spot_price" id="id-8-set_spot_price"></a>

**Über**

Preis pro Tag für Ihr SPOT-Marktplatzangebot festlegen

**Header**

| Feld           | Typ      | Pflichtfeld | Beschreibung                 |
| -------------- | -------- | ----------- | ---------------------------- |
| `auth`         | `string` | Ja          | API-Token                    |
| `Content-Type` | `string` | Ja          | Muss sein `application/json` |

**Body**

| Feld            | Typ     | Pflichtfeld | Beschreibung                  |
| --------------- | ------- | ----------- | ----------------------------- |
| `order_id`      | `int`   | Ja          | Eindeutige Angebots-ID        |
| `desired_price` | `float` | Ja          | Ihr angebotener Preis pro Tag |

**Beispiel**

Versuchen wir, den Spot-Marktpreis zu aktualisieren

**Eingabe 1 (Schritt-Senkung war zu groß):**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "order_id":39,
    "desired_price":0.00000200
}' 'https://api.clore.ai/v1/set_spot_price'
```

**Mögliche Ausgabe 1 (Schritt-Senkung war zu groß):**\
Sie können den Spot-Angebotspreis maximal um 0.00000100 ₿ senken

| Feld       | Typ      | Beschreibung                                                          |
| ---------- | -------- | --------------------------------------------------------------------- |
| `code`     | `int`    | Statuscode                                                            |
| `error`    | `string` | Fehlerbeschreibungsfeld                                               |
| `max_step` | `float`  | Kleinster möglicher Wert, auf den Sie den Preis aktuell senken können |

```
{
    "error":"exceeded_max_step",
    "max_step":0.0000032,
    "code":6
}
```

**Eingabe 2 (Gültige Preissenkung):**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "order_id":39,
    "desired_price":0.00000320
}' 'https://api.clore.ai/v1/set_spot_price'
```

**Mögliche Ausgabe 2 (Gültige Preissenkung):**

```
{
    "code": 0
}
```

**Eingabe 3 (Preis noch weiter senken nach Senden von Eingabe 2):**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "order_id":39,
    "desired_price":0.00000220
}' 'https://api.clore.ai/v1/set_spot_price
```

**Mögliche Ausgabe 3 (Preis noch weiter senken nach Senden von Eingabe 2):**\
Sie können den Spot-Preis nur einmal in 600 Sekunden senken

| Feld               | Typ      | Beschreibung                                                               |
| ------------------ | -------- | -------------------------------------------------------------------------- |
| `code`             | `int`    | Statuscode                                                                 |
| `error`            | `string` | Fehlerbeschreibungsfeld                                                    |
| `time_to_lowering` | `float`  | Verbleibende Zeit (Sek.) bis zur nächsten Möglichkeit, den Preis zu senken |

```
{
    "error":"can_lower_every_600_seconds",
    "time_to_lowering":513,
    "code":6
}
```

#### 9. `cancel_order` <a href="#id-9-cancel_order" id="id-9-cancel_order"></a>

**Über**

Preis pro Tag für Ihr SPOT-Marktplatzangebot festlegen

**Header**

| Feld           | Typ      | Pflichtfeld | Beschreibung                 |
| -------------- | -------- | ----------- | ---------------------------- |
| `auth`         | `string` | Ja          | API-Token                    |
| `Content-Type` | `string` | Ja          | Muss sein `application/json` |

**Body**

| Feld    | Typ      | Pflichtfeld | Beschreibung                                                                                                                             |
| ------- | -------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `id`    | `int`    | Ja          | Eindeutige Bestell-/Angebots-ID                                                                                                          |
| `issue` | `string` | Nein        | Wenn Sie Probleme mit dem Server festgestellt haben, können Sie diese dem [clore.ai](http://clore.ai/) Team melden, maximal 2048 Zeichen |

**Ausgabe**

| Feld   | Typ   | Beschreibung |
| ------ | ----- | ------------ |
| `code` | `int` | Statuscode   |

**Beispiel**

Bestellung/Angebot stornieren

**Eingabe:**\
In diesem Beispiel melden wir Probleme mit GPU #1; wenn Sie keine Probleme haben, fügen Sie das Feld issue nicht hinzu.\
Sie können eine beliebige Nachricht in das Textfeld schreiben und wir werden sie untersuchen

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "id":39,
    "issue":"GPU #1 Überhitzte und drosselte"
}' 'https://api.clore.ai/v1/cancel_order'
```

**Ausgabe:**

```
{
  "code": 0
}
```

#### 10. `create_order` <a href="#id-10-create_order" id="id-10-create_order"></a>

**Über**

Sie können mit diesem Endpunkt ein Spot-Angebot oder eine On-Demand-Bestellung erstellen\
Dieser Endpunkt erlaubt außerdem nur 1 Anfrage in 5 Sekunden

**Header**

| Feld           | Typ      | Pflichtfeld | Beschreibung                 |
| -------------- | -------- | ----------- | ---------------------------- |
| `auth`         | `string` | Ja          | API-Token                    |
| `Content-Type` | `string` | Ja          | Muss sein `application/json` |

**Body**

| Feld                 | Typ      | Pflichtfeld | Beschreibung                                                                                                                                                           |
| -------------------- | -------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `currency`           | `string` | Ja          | Währungsname                                                                                                                                                           |
| `image`              | `string` | Ja          | Gültiges Image von Docker Hub                                                                                                                                          |
| `renting_server`     | `int`    | Ja          | ID des Servers, den Sie mieten möchten                                                                                                                                 |
| `type`               | `string` | Ja          | `on-demand` ODER `spot`                                                                                                                                                |
| `spotprice`          | `float`  | Abhängig    | Angebotener Preis pro Tag auf dem Spot-Markt, erforderlich bei Erstellung einer Spot-Bestellung                                                                        |
| `ports`              | `Objekt` | Nein        | Portweiterleitungs-Konfiguration, max. 5 Einträge                                                                                                                      |
| `env`                | `Objekt` | Nein        | <p>Umgebungsvariablen, auf insgesamt 12000 Zeichen begrenzt, wenn als String dargestellt.<br>Variablenname - max. 128 Zeichen<br>Variablenwert - max. 1536 Zeichen</p> |
| `jupyter_token`      | `string` | Nein        | Jupyter-Token für Images mit Jupyter-Notebooks, maximal 32 Zeichen \*                                                                                                  |
| `ssh_key`            | `string` | Nein        | SSH-Schlüssel für Images mit SSH, maximal 3072 Zeichen \*                                                                                                              |
| `ssh_password`       | `string` | Nein        | SSH-Passwort für Images mit SSH, maximal 32 Zeichen \*                                                                                                                 |
| `command`            | `string` | Nein        | Befehl wird auf dem Server nach der Erstellung der Bestellung ausgeführt                                                                                               |
| `required_price`     | `float`  | Nein        | Geben Sie den Preis an, zu dem Sie die Bestellung starten möchten; wenn der Maschinen-Besitzer den Preis ändert, wird die Bestellung nicht gestartet (nur On-Demand)   |
| `autossh_entrypoint` | `bool`   | Nein        | Verwenden Sie den clore.ai-Entrypoint, der automatisch einen SSH-Server und ein benutzerdefiniertes `/root/onstart.sh` Skript                                          |

\* In Felder, die mit einem Stern markiert sind, können Sie nur Zeichen aus dieser Regexp-Gruppe eingeben `/^[a-zA-Z0-9\s-=.@+/]+$/`

**Ausgabe**

| Feld   | Typ   | Beschreibung |
| ------ | ----- | ------------ |
| `code` | `int` | Statuscode   |

**Beispiel**

**Eingabe 1 (Spot-Angebot erstellen):**

```
curl -XPOST -H 'auth: 6FcuR7ibcwKR1Z32lEFoSotzUUtzKO2H' -H "Content-type: application/json" -d '
{
    "currency":"bitcoin",
    "image":"cloreai/ubuntu20.04-jupyter",
    "renting_server":6,
    "type":"spot",
    "spotprice":0.000001,
    "ports":{
        "22":"tcp",
        "8888":"http"
    },
    "env":{
        "VARIABLE_NAME":"VARIABLE_VALUE",
    },
    "jupyter_token":"hoZluOjbCOQ5D5yH7R",
    "ssh_password":"Hpcj08ZaOpCbTmn1Eu",
    "command":"#!/bin/sh\napt update -y && apt install htop"
}' 'https://api.clore.ai/v1/create_order'
```

**Ausgabe 1 (Spot-Angebot erstellen):**

```
{
  "code":0
}
```

**Eingabe 2 (Auf Abruf Bestellung erstellen):**

```
curl -XPOST -H 'auth: 6FcuR7ibcwKR1Z32lEFoSotzUUtzKO2H' -H "Content-type: application/json" -d '
{
    "currency":"bitcoin",
    "image":"cloreai/ubuntu20.04-jupyter",
    "renting_server":6,
    "type":"on-demand",
    "ports":{
        "22":"tcp",
        "8888":"http"
    },
    "env":{
        "VARIABLE_NAME":"VARIABLE_VALUE",
    },
    "jupyter_token":"hoZluOjbCOQ5D5yH7R",
    "ssh_password":"Hpcj08ZaOpCbTmn1Eu",
    "command":"#!/bin/sh\napt update -y && apt install htop"
}' 'https://api.clore.ai/v1/create_order'
```

**Ausgabe 2 (Auf Abruf Bestellung erstellen):**

```
{
  "code":0
}
```


---

# 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.clore.ai/clore.ai/clore.ai-eng-de/fur-hosts/api.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.
