> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/for-hosts/api.md).

# API

> 💡 **Python Developers:** Use the official [clore-ai Python SDK](/developers/python-sdk.md) instead of raw API calls. It handles authentication, rate limiting, retries, and error handling automatically.
>
> **Quick start:** `pip install clore-ai` — See the [Python SDK docs](/developers/python-sdk.md) and [CLI Reference](/developers/cli-guide.md).

> 🧭 Prefer a browsable reference? Open the interactive API docs at [clore.ai/api-docs](https://clore.ai/api-docs). Base URL for all endpoints on this page: `https://api.clore.ai/v1/`.

<div data-full-width="true"><figure><img src="https://2864042869-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbyNlC5NV8aIpXnc76G7w%2Fuploads%2FoEhopGeayaKnbuDjgTEs%2FCLORE%20Docs%20API%20Page.png?alt=media&amp;token=a0adf6bb-1fde-4f1b-8236-dff2563ffbfd" alt=""><figcaption></figcaption></figure></div>

### Introduction <a href="#introduction" id="introduction"></a>

[CLORE.AI](http://clore.ai/) api can be used to automate deployments of your workloads onto [CLORE.AI](http://clore.ai/)

Firstly you need to get an API key\
![alt text](https://clore.ai/assets/html/api-export1.png)\
![alt text](https://clore.ai/assets/html/api-export2.png)

***

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

Responses are returned in JSON format, may have different fields

Always returned field is code, indicating status

**code field**

| code | Description                      |
| ---- | -------------------------------- |
| `0`  | NORMAL                           |
| `1`  | DATABASE ERROR                   |
| `2`  | INVALID INPUT DATA               |
| `3`  | INVALID API TOKEN                |
| `4`  | INVALID ENDPOINT                 |
| `5`  | EXCEEDED 1 request/second limit  |
| `6`  | Error specified in `error` field |

***

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

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

**About**

Return wallets and balances

**Headers**

| Field  | Type     | Mandatory | Description |
| ------ | -------- | --------- | ----------- |
| `auth` | `string` | Yes       | API token   |

**Output**

| Field     | Type       | Description      |
| --------- | ---------- | ---------------- |
| `code`    | `int`      | Status code      |
| `wallets` | `[]string` | Array of wallets |

**Example**

**Input:**

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

**Output:**

```
{
  "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>

**About**

Returns your servers that you are providing to [clore.ai](http://clore.ai/) marketplace

**Headers**

| Field  | Type     | Mandatory | Description |
| ------ | -------- | --------- | ----------- |
| `auth` | `string` | Yes       | API token   |

**Output**

| Field                                 | Type       | Description                                                                                                                                                                                                                                                           |
| ------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `code`                                | `int`      | Status code                                                                                                                                                                                                                                                           |
| `limit`                               | `int`      | Maximum number of servers you can own                                                                                                                                                                                                                                 |
| `servers`                             | `[]string` | Array of servers                                                                                                                                                                                                                                                      |
| `servers[x].name`                     | `string`   | User selected server name                                                                                                                                                                                                                                             |
| `servers[x].connected`                | `string`   | Was the server ever connected to [clore.ai](http://clore.ai/)                                                                                                                                                                                                         |
| `servers[x].visibility`               | `string`   | Visibility on marketplace                                                                                                                                                                                                                                             |
| `servers[x].pricing`                  | `[]string` | Price/day on-demand                                                                                                                                                                                                                                                   |
| `servers[x].online`                   | `bool`     | Is server online                                                                                                                                                                                                                                                      |
| `servers[x].min_spot_pricing`         | `[]string` | Minimal price/day to rent for on spot market                                                                                                                                                                                                                          |
| `servers[x].auto_renew_allowed`       | `bool`     | Whether renters' on-demand orders on this server may renew at your current price when they reach the maximum rental length. `true` when you never set it. Absent on a server that is being removed. Change it with [`set_server_settings`](#id-7-set_server_settings) |
| `servers[x].init_token`               | `string`   | Machine-registration token, returned only until the machine is initialized — **treat as a credential**, it registers machines to your account                                                                                                                         |
| `servers[x].specs`                    | `[]string` | Server specifications                                                                                                                                                                                                                                                 |
| `servers[x].remaining_time`           | `int`      | Rental end time of the latest active order (ms epoch)                                                                                                                                                                                                                 |
| `servers[x].rental_state`             | `string`   | Aggregate GPU rental state: `none`, `partial`, or `full`                                                                                                                                                                                                              |
| `servers[x].rented_gpus`              | `int`      | GPUs currently rented across active orders                                                                                                                                                                                                                            |
| `servers[x].total_gpus`               | `int`      | Total GPUs on the server                                                                                                                                                                                                                                              |
| `servers[x].rented_price_by_currency` | `object`   | Sum of active order prices keyed by currency                                                                                                                                                                                                                          |
| `servers[x].update_channel`           | `string`   | Hosting-agent update channel: `stable` or `beta`                                                                                                                                                                                                                      |
| `servers[x].requested_channel`        | `string`   | Channel switch requested from the web UI (present only when requested)                                                                                                                                                                                                |
| `servers[x].target_backend_version`   | `int`      | Backend version the current channel targets                                                                                                                                                                                                                           |

> The rental-state fields (`remaining_time`, `rental_state`, `rented_gpus`, `total_gpus`, `rented_price_by_currency`) are present only while the server has an active order.

**Example**

**Input:**

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

**Output:**

```
{
  "servers": [
    {
      "name": "Michael",
      "connected": false,
      "visibility": "hidden",
      "pricing": { "bitcoin": 0, "usd": 0 },
      "online": false,
      "min_spot_pricing": { "bitcoin": 0, "usd": 0 },
      "auto_renew_allowed": true,
      "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 },
      "auto_renew_allowed": true,
      "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 values in `pricing` objects reflect the USD-based pricing mode where the host enabled it.

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

**About**

Get configuration of specific server

**Headers**

| Field          | Type     | Mandatory | Description                |
| -------------- | -------- | --------- | -------------------------- |
| `auth`         | `string` | Yes       | API token                  |
| `Content-type` | `string` | Yes       | Must be `application/json` |

**Body**

| Field         | Type     | Mandatory | Description |
| ------------- | -------- | --------- | ----------- |
| `server_name` | `string` | Yes       | Server name |

**Output**

| Field                       | Type                 | Description                                                                                                                          |
| --------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `code`                      | `int`                | Status code                                                                                                                          |
| `creation_completed`        | `bool`               | Is server creation complete                                                                                                          |
| `config`                    | `[]string`           | Config of server                                                                                                                     |
| `config.name`               | `string`             | User selected server name                                                                                                            |
| `config.connected`          | `bool`               | Was the server ever connected to [clore.ai](http://clore.ai/)                                                                        |
| `config.visibility`         | `string`             | Visibility on marketplace                                                                                                            |
| `config.pricing`            | `[]string`           | Price/day on-demand                                                                                                                  |
| `config.spot_pricing`       | `[]string`           | Minimal price/day to rent for on spot market                                                                                         |
| `config.mrl`                | `int`                | Maximum rental length in hours                                                                                                       |
| `config.auto_renew_allowed` | `bool`               | Whether renters' on-demand orders on this server may renew at your current price when they reach `mrl`. `true` when you never set it |
| `config.online`             | `bool`               | Is server online                                                                                                                     |
| `config.initialized`        | `bool`               | Was the server ever connected to [clore.ai](http://clore.ai/)                                                                        |
| `config.id`                 | `int`                | Unique server ID                                                                                                                     |
| `config.rental_status`      | `int`                | 0 - not rented \| 1 - Rented on spot market \| 2 - Rented On Demand \| 3 - Fixed-USD rental                                          |
| `config.specs`              | `[]string`           | Server specifications                                                                                                                |
| `config.background_job`     | `object`             | Background job when not rented: `image`, `command`, `env`, `times_updated`                                                           |
| `config.autoprice`          | `object` \| `string` | Per-currency autopricing configuration (legacy string values `"pow"` / `"usd"` also occur)                                           |
| `config.usd_pricing`        | `object`             | USD price targets — present only when USD autopricing is enabled                                                                     |
| `config.tenants`            | `[]object`           | Active orders on the server: `rental_type`, `currency`, `price`, `remaining_time`, `gpu_count`                                       |

> `server_config` also returns the same rental-state and update-channel fields as `my_servers`: `remaining_time`, `rental_state`, `rented_gpus`, `total_gpus`, `rented_price_by_currency`, `update_channel`, `requested_channel`, `target_backend_version`. In both endpoints the rental-state fields are present only while the server has an active order.

**Example**

**Input:**

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

**Output:**

```
{
  "config": {
    "name": "Jan Vykydal",
    "connected": true,
    "visibility": "public",
    "pricing": { "bitcoin": 0.00010337, "usd": 0 },
    "spot_pricing": { "bitcoin": 0.00005168, "usd": 0 },
    "mrl": 72,
    "auto_renew_allowed": true,
    "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 values in `pricing` objects reflect the USD-based pricing mode where the host enabled it.

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

**About**

Get marketplace

**Headers**

| Field  | Type     | Mandatory | Description |
| ------ | -------- | --------- | ----------- |
| `auth` | `string` | Yes       | API token   |

**Output**

| Field                           | Type               | Description                                                                                                                                                                                                                   |
| ------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `code`                          | `int`              | Status code                                                                                                                                                                                                                   |
| `my_servers`                    | `[]string`         | Array of server ids you are providing to [clore.ai](http://clore.ai/) (can't be rented)                                                                                                                                       |
| `servers`                       | `[]string`         | Array of public servers on marketplace                                                                                                                                                                                        |
| `servers[x].id`                 | `int`              | Unique server ID                                                                                                                                                                                                              |
| `servers[x].owner`              | `int`              | Unique owner ID                                                                                                                                                                                                               |
| `servers[x].mrl`                | `int`              | Maximum rental length in hours. When the server allows auto-renewal, this is also the repricing period: a renewing order takes the host's current price each time it reaches this length                                      |
| `servers[x].auto_renew_allowed` | `bool`             | Whether the host allows auto-renewal on this server. `true` when the host never set it. When `false`, `create_order` with `auto_renew: true` is refused with `auto_renew_not_allowed`, and `rental_hours` cannot exceed `mrl` |
| `servers[x].price.on_demand`    | `[]string`         | On demand price per day                                                                                                                                                                                                       |
| `servers[x].price.spot`         | `[]string`         | Minimal spot market price per day                                                                                                                                                                                             |
| `servers[x].rented`             | `bool`             | Is server rented on demand                                                                                                                                                                                                    |
| `servers[x].specs`              | `[]string`         | Server specifications                                                                                                                                                                                                         |
| `servers[x].partial_gpu_rental` | `object` \| `bool` | `false` when partial rental is unavailable, otherwise `{ total_gpus, available_gpus, free_indices }`                                                                                                                          |

> `price.on_demand` and `price.spot` only include the currencies each server actually accepts — a server without a price in some currency cannot be rented in it.
>
> The listing is a cached snapshot, so a change to a server's `mrl` or `auto_renew_allowed` can take a few minutes to show here.

**Example**

Get marketplace

**Input:**

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

**Output:**

```
{
  "servers": [
    {
      "id": 6,
      "owner": 4,
      "mrl": 73,
      "price": { "on_demand": { "bitcoin": 0.00001 },
      "spot": { "bitcoin": 0.000001 }},
      "rented": false,
      "auto_renew_allowed": true,
      "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>

**About**

Get your orders

**Headers**

| Field  | Type     | Mandatory | Description |
| ------ | -------- | --------- | ----------- |
| `auth` | `string` | Yes       | API token   |

**Query string**

| Field              | Type   | Mandatory | Description                       |
| ------------------ | ------ | --------- | --------------------------------- |
| `return_completed` | `bool` | No        | Return completed (expired) orders |

**Output**

| Field                            | Type       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| -------------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `code`                           | `int`      | Status code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `limit`                          | `int`      | Currently always 999999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `orders`                         | `[]string` | Array of orders                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `orders[x].id`                   | `int`      | Unique order ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `orders[x].creation_fee`         | `float`    | Creation fee paid to [clore.ai](http://clore.ai/)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `orders[x].price`                | `float`    | Order price (cost) per day                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `orders[x].mrl`                  | `int`      | Seconds from creation to the end of the current term. A renewal adds the new term to it, so `ct + mrl` is always the current end                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `orders[x].image`                | `string`   | Used docker image                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `orders[x].currency`             | `string`   | Currency used for billing                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `orders[x].spend`                | `float`    | Actual amount debited so far: accumulated rental value plus the renter base fee (after PoH reduction) and any extra fee; excludes the one-off creation fee                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `orders[x].gpu_count`            | `int`      | Number of GPUs the order occupies (on-demand orders; equals the rig's total GPUs unless it is a partial rental)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `orders[x].ct`                   | `int`      | Creation time (UNIX time)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `orders[x].p`                    | `int`      | Currently used proxy cluster                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `orders[x].specs`                | `[]string` | Server specifications                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `orders[x].si`                   | `int`      | Unique server ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `orders[x].pub_cluster`          | `[]string` | Public endpoints with forwarded ports                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `orders[x].tcp_ports`            | `[]string` | TCP port forwarding                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `orders[x].http_port`            | `string`   | Container port forwarded through HTTPS proxy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `orders[x].spot`                 | `bool`     | Indication that it is spot order                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `orders[x].expired`              | `bool`     | Indication that the order has expired                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `orders[x].rental_hours`         | `int`      | Hours you asked for, counted from creation (on-demand only). Absent when no limit was requested: the order then ends at the host's maximum rental length unless `auto_renew` is on, in which case it runs until you cancel                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `orders[x].rental_end`           | `int`      | UNIX time when the requested hours are used up; absent when no limit was requested                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `orders[x].term_start`           | `int`      | UNIX time when the current term started (creation, or the last renewal)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `orders[x].term_end`             | `int`      | UNIX time when the current term ends; always `ct + mrl`. Absent on spot orders and on an on-demand order created before auto-renewal shipped and never edited since                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `orders[x].term_mrl`             | `int`      | The host's maximum rental length, in seconds, when the current term started. [`set_order_auto_renew`](#id-16-set_order_auto_renew) can stretch the current term up to `term_start + term_mrl`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `orders[x].last_renewal_at`      | `int`      | UNIX time when the last renewal was applied; absent before the first renewal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `orders[x].auto_renew`           | `bool`     | Whether the order renews at the host's current price when the current term ends. Set to `false` when a renewal is declined. Absent on an order created without auto-renewal and never edited                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `orders[x].auto_renew_max_price` | `float`    | Your per-day price limit for renewals, in the order's currency. A renewal is declined when the host's price is above it                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `orders[x].renewals_count`       | `int`      | Number of renewals applied so far; absent before the first renewal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `orders[x].pending_renewal`      | `object`   | Present while a renewal is scheduled for the end of the current term: `price` (`float`, the next term's price per day) and `term_seconds` (`int`, the next term's length in seconds)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `orders[x].auto_renew_declined`  | `object`   | Present after a renewal was declined: `reason` and `at` (UNIX time of the decision). The order ends with its current term. `reason` is one of `price_above_cap` (the host's new per-day price is above `auto_renew_max_price`), `server_unlisted` (the server is hidden or being removed, no longer accepts the order's currency or has no price in it, or no longer passes the health checks a new order must pass), `host_disallowed` (the host turned auto-renewal off), `server_reserved` (the server is reserved for another renter) or `insufficient_balance` (after paying for the time up to the end of the term, your balance would cover less than an hour at the new price) |

> Every on-demand order created since auto-renewal shipped carries `term_start`, `term_end` and `term_mrl`. The other renewal fields appear only when they apply: `rental_hours` and `rental_end` when hours were requested, `auto_renew` and `auto_renew_max_price` when auto-renewal was requested at creation or set through [`set_order_auto_renew`](#id-16-set_order_auto_renew), and `renewals_count` and `last_renewal_at` after the first renewal. See [Rental Length and Auto-Renewal](/for-renters/order-management.md#rental-length-and-auto-renewal).

**Input:**

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

The first order below is an on-demand order on a server with a 73-hour maximum rental length (`mrl` of 262800 seconds), created with `rental_hours: 120` and auto-renewal on, and still in its first term. The second is an expired spot order.

**Output:**

```
{
  "orders": [
    {
      "id": 38,
      "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",
      "ssh_auth": "password",
      "rental_hours": 120,
      "rental_end": 1667833396,
      "term_start": 1667401396,
      "term_end": 1667664196,
      "term_mrl": 262800,
      "auto_renew_max_price": 0.0000125,
      "auto_renew": true
    },{
      "id": 36,
      "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,
      "ssh_auth": "password",
      "expired": true,
      "tcp_ports": []
    }
  ],
  "limit": 999999,
  "code": 0
}
```

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

**About**

Get spot marketplace for specific server

**Headers**

| Field  | Type     | Mandatory | Description |
| ------ | -------- | --------- | ----------- |
| `auth` | `string` | Yes       | API token   |

**Query string**

| Field    | Type  | Mandatory | Description      |
| -------- | ----- | --------- | ---------------- |
| `market` | `int` | Yes       | Unique server ID |

**Output**

| Field                          | Type     | Description                                           |
| ------------------------------ | -------- | ----------------------------------------------------- |
| `code`                         | `int`    | Status code                                           |
| `exists`                       | `bool`   | Verification that the market exists                   |
| `market`                       | `object` | Marketplace                                           |
| `market.offers`                | `array`  | Rental offers for the server                          |
| `market.offers[x].offer_id`    | `int`    | Unique offer ID                                       |
| `market.offers[x].bid`         | `float`  | Offered price per day (in the offer's currency)       |
| `market.offers[x].currency`    | `string` | Currency of the bid                                   |
| `market.offers[x].active`      | `bool`   | This offer is currently used                          |
| `market.offers[x].my`          | `bool`   | This offer is owned by me                             |
| `market.server`                | `object` | Server information                                    |
| `market.server.min_pricing`    | `object` | Minimal offer price per day, per accepted currency    |
| `market.server.mrl`            | `int`    | Maximum rental length in **hours**                    |
| `market.server.visibility`     | `string` | You can create offers only when visibility is public  |
| `market.server.online`         | `bool`   | Server is online                                      |
| `market.currency_rates_in_usd` | `object` | Live USD rates used to compare bids across currencies |

> Offers can be placed in any currency the server accepts; competing bids are compared by their **USD value** (using `currency_rates_in_usd`), not face value.
>
> ⚠️ **Changed in August 2026:** `market.server.mrl` is now returned in **hours** (previously seconds). A value that read `262800` now reads `73`.

**Input:**

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

**Output:**

```
{
  "market": {
    "offers": [
      {
        "offer_id": 39,
        "bid": 0.0000042,
        "active": true,
        "my": true,
        "currency": "bitcoin"
      }
    ],
    "server": {
      "min_pricing": {
        "bitcoin": 0.000001
      },
      "mrl": 73,
      "visibility": "public",
      "online": true
    },
    "currency_rates_in_usd": {
      "bitcoin": 110000,
      "CLORE-Blockchain": 0.0045,
      "USD-Blockchain": 1
    }
  },
  "exists": true,
  "code": 0
}
```

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

**About**

Configure settings of server you are providing on [clore.ai](http://clore.ai/) marketplace

**Headers**

| Field          | Type     | Mandatory | Description                |
| -------------- | -------- | --------- | -------------------------- |
| `auth`         | `string` | Yes       | API token                  |
| `Content-type` | `string` | Yes       | Must be `application/json` |

**Body**

| Field                        | Type     | Mandatory | Description                                                                                                                                                                                                                                    |
| ---------------------------- | -------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`                       | `string` | Yes       | User selected server name                                                                                                                                                                                                                      |
| `availability`               | `bool`   | Yes       | Can server be rented                                                                                                                                                                                                                           |
| `mrl`                        | `int`    | Yes       | Maximum server rental length in **hours** (6 to 3000)                                                                                                                                                                                          |
| `bitcoin_on_demand`          | `float`  | Yes       | On-demand price in BTC per day                                                                                                                                                                                                                 |
| `bitcoin_spot`               | `float`  | Yes       | Minimum spot price in BTC per day                                                                                                                                                                                                              |
| `CLORE-Blockchain_on_demand` | `float`  | No        | On-demand price in CLORE per day                                                                                                                                                                                                               |
| `CLORE-Blockchain_spot`      | `float`  | No        | Minimum spot price in CLORE per day                                                                                                                                                                                                            |
| `USD-Blockchain_on_demand`   | `float`  | No        | On-demand price in USD per day                                                                                                                                                                                                                 |
| `USD-Blockchain_spot`        | `float`  | No        | Minimum spot price in USD per day                                                                                                                                                                                                              |
| `enabled-bitcoin`            | `bool`   | No\*      | Accept Bitcoin for this server                                                                                                                                                                                                                 |
| `enabled-CLORE-Blockchain`   | `bool`   | No\*      | Accept CLORE for this server                                                                                                                                                                                                                   |
| `enabled-USD-Blockchain`     | `bool`   | No\*      | Accept USD stablecoins for this server                                                                                                                                                                                                         |
| `autoprice`                  | `object` | No        | Per-currency autopricing: set a currency key (`bitcoin`, `CLORE-Blockchain`) to `"usd"` for USD-based autopricing or `false` for fixed pricing                                                                                                 |
| `usd_pricing`                | `object` | No        | USD price targets per currency, e.g. `{ "bitcoin": { "on_demand": 10, "spot": 5 } }` — used only for currencies with `autoprice` set to `"usd"`                                                                                                |
| `auto_renew_allowed`         | `bool`   | No        | Allow renters' on-demand orders to renew at your current price when they reach `mrl`. Omit it to keep the stored setting; a server that never set it allows renewals. A value other than `true` or `false` is refused with code `2` (HTTP 400) |

> \* **The accepted-currency list is rebuilt from the `enabled-*` flags on every call.** A currency without its `enabled-<currency>: true` flag (or without a valid price) is dropped from the server's accepted currencies — omitting all flags leaves the server unrentable in every currency. Always send `enabled-<currency>: true` for each currency you want to keep accepting.
>
> Per-day prices are capped per currency: 0.000001–0.1 BTC, 0.1–5,000,000 CLORE, 0.1–10,000 USD.
>
> When a currency is autopriced in USD, its listed crypto price is derived from `usd_pricing` at the live exchange rate (re-derived about every 10 minutes) and any `<currency>_on_demand` / `<currency>_spot` value sent for it is ignored. The `usd_pricing` targets are whole-server $/day figures validated against the USD range (0.1 to 10,000); out-of-range values clamp to the nearest bound.
>
> With `auto_renew_allowed` on (the default), `mrl` is also your repricing period: an order whose renter chose auto-renewal renews each time it reaches `mrl`, at your price at that moment. Setting it to `false` never ends a running rental: each order on the server finishes its current term and its renewal is declined with `host_disallowed`.

**Output**

| Field  | Type  | Description |
| ------ | ----- | ----------- |
| `code` | `int` | Status code |

**Example**

**Input:**

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

**Output:**

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

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

**About**

Set price per day on your SPOT market offer

**Headers**

| Field          | Type     | Mandatory | Description                |
| -------------- | -------- | --------- | -------------------------- |
| `auth`         | `string` | Yes       | API token                  |
| `Content-type` | `string` | Yes       | Must be `application/json` |

**Body**

| Field           | Type    | Mandatory | Description                |
| --------------- | ------- | --------- | -------------------------- |
| `order_id`      | `int`   | Yes       | Unique offer ID            |
| `desired_price` | `float` | Yes       | Your offered price per day |

> **A price below the server's current spot floor** is rejected with the current minimum included:
>
> ```
> { "error": "amount_too_low", "min_price": 0.0000012, "code": 6 }
> ```
>
> **A raise must be at least 1% above both your current bid and the server's top bid in the same currency** (rounded up to the currency's precision, capped at the price ceiling). A smaller raise is rejected with the lowest accepted price:
>
> ```
> { "error": "below_min_raise_step", "min_price": 0.00000425, "code": 6 }
> ```

**Example**

Let's try to update spot market price

**Input 1 (Step down was too big):**

```
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'
```

**Possible output 1 (Step down was too big):**\
You can lower spot market offer price by max of 0.00000100 ₿

| Field      | Type     | Description                                                 |
| ---------- | -------- | ----------------------------------------------------------- |
| `code`     | `int`    | Status code                                                 |
| `error`    | `string` | Error description field                                     |
| `max_step` | `float`  | Lowest possible value to what you can currently lower price |

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

**Input 2 (Valid price step down):**

```
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'
```

**Possible output 2 (Valid price step down):**

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

**Input 3 (Lower price even more after sending Input 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
```

**Possible output 3 (Lower price even more after sending Input 2):**\
You can lower spot price once in 600 seconds

| Field              | Type     | Description                                             |
| ------------------ | -------- | ------------------------------------------------------- |
| `code`             | `int`    | Status code                                             |
| `error`            | `string` | Error description field                                 |
| `time_to_lowering` | `float`  | Remaining time (sec) to next possibility to lower price |

```
{
    "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>

**About**

Cancel an active order or spot offer

**Headers**

| Field          | Type     | Mandatory | Description                |
| -------------- | -------- | --------- | -------------------------- |
| `auth`         | `string` | Yes       | API token                  |
| `Content-type` | `string` | Yes       | Must be `application/json` |

**Body**

| Field   | Type     | Mandatory | Description                                                                                                                          |
| ------- | -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `id`    | `int`    | Yes       | Unique order/offer ID                                                                                                                |
| `issue` | `string` | No        | If you have encountered any issues with the server you can report them to [clore.ai](http://clore.ai/) team, maximum 2048 characters |

**Output**

| Field  | Type  | Description |
| ------ | ----- | ----------- |
| `code` | `int` | Status code |

**Example**

Cancel order/offer

**Input:**\
In this example we are reporting issues with GPU #1, if you don't have issues, don't include issue field.\
You can write any message to text field and we will investigate it

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

**Output:**

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

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

**About**

You can create spot offer or on demand order with this endpoint

**Headers**

| Field          | Type     | Mandatory | Description                |
| -------------- | -------- | --------- | -------------------------- |
| `auth`         | `string` | Yes       | API token                  |
| `Content-type` | `string` | Yes       | Must be `application/json` |

**Body**

| Field                  | Type     | Mandatory | Description                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ---------------------- | -------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `currency`             | `string` | Yes       | Currency name                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `image`                | `string` | Yes       | Valid image from dockerhub                                                                                                                                                                                                                                                                                                                                                                                                          |
| `renting_server`       | `int`    | Yes       | ID of server you want to rent                                                                                                                                                                                                                                                                                                                                                                                                       |
| `type`                 | `string` | Yes       | `on-demand` OR `spot`                                                                                                                                                                                                                                                                                                                                                                                                               |
| `spotprice`            | `float`  | Depends   | Offering price per day on spot market, required when making spot order                                                                                                                                                                                                                                                                                                                                                              |
| `ports`                | `object` | No        | Port forwarding configuration, max 5 records                                                                                                                                                                                                                                                                                                                                                                                        |
| `env`                  | `object` | No        | <p>Environment variables, limited to 12288 characters in total when stringified.<br>Variable name - 128 symbols max, must not contain <code>-</code><br>Variable value - 1536 symbols max<br>Only the first 30 valid variables are kept; extras are silently dropped</p>                                                                                                                                                            |
| `jupyter_token`        | `string` | No        | Jupyter token for images that has jupyter notebooks, maximum 32 characters \*                                                                                                                                                                                                                                                                                                                                                       |
| `ssh_key`              | `string` | No        | SSH key for images with SSH, maximum 3072 characters \*                                                                                                                                                                                                                                                                                                                                                                             |
| `ssh_password`         | `string` | No        | SSH password for images with SSH, maximum 32 characters \*                                                                                                                                                                                                                                                                                                                                                                          |
| `command`              | `string` | No        | Command will be run on server after order creation                                                                                                                                                                                                                                                                                                                                                                                  |
| `required_price`       | `float`  | No        | Specify price for what you want to start the order, if machine owner changes the price, then order will not start (on demand only)                                                                                                                                                                                                                                                                                                  |
| `gpu_count`            | `int`    | No        | Number of GPUs to rent on servers that support [partial rental](/for-renters/partial-gpu-rental.md). Omit to rent the whole rig. On-demand only, homogeneous rigs only                                                                                                                                                                                                                                                              |
| `gpu_indices`          | `[]int`  | No        | 0-based GPU slot indices to rent; length must equal `gpu_count`. Take free slots from `partial_gpu_rental.free_indices`. Omit to let the backend pick free GPUs automatically                                                                                                                                                                                                                                                       |
| `autossh_entrypoint`   | `bool`   | No        | Use clore.ai entrypoint, that autometically deploy SSH server and custom `/root/onstart.sh` script                                                                                                                                                                                                                                                                                                                                  |
| `rental_hours`         | `int`    | No        | On-demand only. How long you want the machine, in whole hours from 1 to 3000 (the platform maximum), counted from the order's creation. Omit it to request no limit: the order then ends at the server's `mrl` unless `auto_renew` is on, in which case it runs until you cancel. A value above the server's `mrl` requires `auto_renew: true`; a value at or below it ends the order after that many hours. Ignored on spot orders |
| `auto_renew`           | `bool`   | No        | On-demand only. When the server's maximum rental length is reached, renew the order on the same container at the server's current price, as long as that price is at or under `auto_renew_max_price`, until `rental_hours` are used, or until you cancel when `rental_hours` is omitted. No creation fee is charged on a renewal. Refused on spot orders and on servers whose `auto_renew_allowed` is `false`                       |
| `auto_renew_max_price` | `float`  | Depends   | Required when `auto_renew` is `true`. Per-day price limit in the order's currency, above 0 and at most the marketplace's maximum price for that currency (0.1 BTC, 5,000,000 CLORE, 10,000 USD). At each renewal it is compared with the server's price per day, scaled to `gpu_count` on a partial rental                                                                                                                          |

\* To fields marked with star you can only input characters from this regexp group `/^[a-zA-Z0-9\s-=.@+/]+$/`

**Output**

| Field   | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `code`  | `int`    | Status code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `error` | `string` | Present with code `6` (HTTP 200) when the order is refused. Rental length and auto-renewal refusals: `invalid_rental_hours` (not a whole number from 1 to 3000, or `null`), `rental_hours_exceeds_mrl` (above the server's `mrl` without `auto_renew: true`), `invalid_auto_renew` (`auto_renew` is not a boolean, or it is `true` without a positive `auto_renew_max_price`, or with one above the marketplace's maximum price for the currency), `auto_renew_not_supported` (`auto_renew: true` on a spot order), `auto_renew_not_allowed` (the server does not allow auto-renewal). Spot bid refusals are described below |

> **Spot bids below the server's floor** are rejected with the current minimum included, so you can retry immediately:
>
> ```
> { "error": "too_low_price", "min_price": 0.0000012, "code": 6 }
> ```
>
> The floor is recomputed from live coin rates roughly every 10 minutes, so a price read off the marketplace listing can be slightly stale — always use the returned `min_price` for the retry.
>
> **When the server already has spot bids in the same currency**, a new bid must be at least 1% above the top one (rounded up to the currency's precision, capped at the price ceiling). A lower bid is rejected with the lowest accepted price:
>
> ```
> { "error": "below_min_raise_step", "min_price": 0.00000425, "code": 6 }
> ```

**Example**

**Input 1 (Create spot offer):**

```
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'
```

**Output 1 (Create spot offer):**

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

**Input 2 (Create on demand order):**

```
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'
```

**Output 2 (Create on demand order):**

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

**Input 3 (On demand order for 48 hours with auto-renewal):**

```
curl -XPOST -H 'auth: 6FcuR7ibcwKR1Z32lEFoSotzUUtzKO2H' -H "Content-type: application/json" -d '
{
    "currency":"CLORE-Blockchain",
    "image":"cloreai/jupyter:ubuntu24.04-v2",
    "renting_server":6,
    "type":"on-demand",
    "rental_hours":48,
    "auto_renew":true,
    "auto_renew_max_price":250
}' 'https://api.clore.ai/v1/create_order'
```

**Output 3 (On demand order for 48 hours with auto-renewal):**

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

On a server with a 24-hour `mrl` the first term lasts 24 hours. At its end the order renews for another 24 hours at the server's price at that time, if it is at or under 250 CLORE per day, then ends because the 48 requested hours are used up. With `auto_renew` on, omitting `rental_hours` keeps it renewing until you cancel. Without `auto_renew`, the same `rental_hours` on that server is refused:

```
{ "error": "rental_hours_exceeds_mrl", "code": 6 }
```

#### 11. `renter_fees` <a href="#id-11-renter_fees" id="id-11-renter_fees"></a>

**About**

Get the current fee configuration: base renter fees, PoH fee reduction settings, order creation fees, and your PoH balance

**Headers**

| Field  | Type     | Mandatory | Description |
| ------ | -------- | --------- | ----------- |
| `auth` | `string` | Yes       | API token   |

**Output**

| Field                              | Type     | Description                                           |
| ---------------------------------- | -------- | ----------------------------------------------------- |
| `code`                             | `int`    | Status code                                           |
| `renter_fees.on_demand`            | `object` | Base fee (%) per currency for on-demand orders        |
| `renter_fees.spot`                 | `object` | Base fee (%) per currency for spot orders             |
| `poh_config.max_reduction_percent` | `int`    | Maximum base-fee reduction through PoH (%)            |
| `poh_config.max_poh_amount`        | `int`    | PoH balance at which the maximum reduction is reached |
| `creation_fees.on_demand`          | `object` | Order creation fee per currency                       |
| `creation_fees.spot`               | `object` | Spot order creation fee per currency                  |
| `poh_balance`                      | `float`  | Your PoH CLORE balance                                |

**Input:**

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

**Output:**

```
{
  "renter_fees": {
    "on_demand": {
      "base": { "bitcoin": 5, "CLORE-Blockchain": 5, "USD-Blockchain": 5 }
    },
    "spot": {
      "base": { "bitcoin": 1.25, "CLORE-Blockchain": 1.25, "USD-Blockchain": 1.25 }
    }
  },
  "poh_config": { "max_reduction_percent": 50, "max_poh_amount": 2000000 },
  "creation_fees": {
    "on_demand": { "bitcoin": 3e-7, "CLORE-Blockchain": 0.5, "USD-Blockchain": 0.1 },
    "spot": { "bitcoin": 1e-7, "CLORE-Blockchain": 0.05, "USD-Blockchain": 0.005 }
  },
  "poh_balance": 5000,
  "code": 0
}
```

#### 12. `cancel_orders` <a href="#id-12-cancel_orders" id="id-12-cancel_orders"></a>

**About**

Cancel multiple orders at once (up to 256 per request)

**Headers**

| Field          | Type     | Mandatory | Description                |
| -------------- | -------- | --------- | -------------------------- |
| `auth`         | `string` | Yes       | API token                  |
| `Content-type` | `string` | Yes       | Must be `application/json` |

**Body**

| Field       | Type    | Mandatory | Description                      |
| ----------- | ------- | --------- | -------------------------------- |
| `order_ids` | `[]int` | Yes       | Order IDs to cancel, maximum 256 |

**Output**

| Field              | Type    | Description                           |
| ------------------ | ------- | ------------------------------------- |
| `code`             | `int`   | Status code                           |
| `failed_to_cancel` | `[]int` | Order IDs that could not be cancelled |

**Input:**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "order_ids": [38, 39]
}' 'https://api.clore.ai/v1/cancel_orders'
```

**Output:**

```
{
  "failed_to_cancel": [],
  "code": 0
}
```

#### 13. `poh_balance` <a href="#id-13-poh_balance" id="id-13-poh_balance"></a>

**About**

Get your Proof of Holding balance: items, totals, and PoH Marketplace offer amounts

**Headers**

| Field  | Type     | Mandatory | Description |
| ------ | -------- | --------- | ----------- |
| `auth` | `string` | Yes       | API token   |

**Output**

| Field                                         | Type       | Description                             |
| --------------------------------------------- | ---------- | --------------------------------------- |
| `code`                                        | `int`      | Status code                             |
| `items`                                       | `[]object` | Your PoH items with individual balances |
| `balance.total`                               | `float`    | Total PoH balance across all items      |
| `balance.free_amount`                         | `float`    | PoH balance not committed to offers     |
| `balance.reward_amount`                       | `float`    | Balance eligible for rewards            |
| `balance.offers.rented_amount`                | `float`    | Amount rented out to other users        |
| `balance.offers.rented_on_marketplace_amount` | `float`    | Amount listed on the PoH Marketplace    |
| `balance.offers.leased_amount`                | `float`    | Amount leased from other users          |

**Input:**

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

**Output:**

```
{
  "items": [ { "balance": 5000 } ],
  "balance": {
    "total": 5000,
    "free_amount": 4000,
    "reward_amount": 5000,
    "offers": {
      "rented_amount": 0,
      "rented_on_marketplace_amount": 1000,
      "rented_finished_amount": 0,
      "leased_amount": 0
    }
  },
  "code": 0
}
```

#### 14. `server-config.json` <a href="#id-14-server-config-json" id="id-14-server-config-json"></a>

**About**

Get static API configuration data. No authentication required

**Input:**

```
curl -XGET 'https://api.clore.ai/v1/server-config.json'
```

#### 15. `get_relay` <a href="#id-15-get_relay" id="id-15-get_relay"></a>

**About**

Get TCP forwarding relay nodes for your detected country. No authentication required

**Output**

| Field     | Type     | Description           |
| --------- | -------- | --------------------- |
| `code`    | `int`    | Status code           |
| `country` | `string` | Detected country code |
| `nodes`   | `object` | Available relay nodes |

**Input:**

```
curl -XGET 'https://api.clore.ai/v1/get_relay'
```

#### 16. `set_order_auto_renew` <a href="#id-16-set_order_auto_renew" id="id-16-set_order_auto_renew"></a>

**About**

Change the requested rental length, auto-renewal and its price limit of your active on-demand order. Send only the fields you want to change; an omitted field keeps its current value. POST only; a GET answers code `4`.

* The current term then ends at the requested end or at `term_start + term_mrl`, whichever comes first, and never sooner than 60 seconds from now. `mrl` and `term_end` change to match. Running past `term_start + term_mrl` needs `auto_renew`, and the renewal at the end of the term reprices it.
* Lengthening the request past `term_start + term_mrl` is possible only while `auto_renew` is on; otherwise it is refused with `rental_hours_exceeds_mrl`. Changing a set `rental_hours` to `null` while `auto_renew` stays off counts as lengthening, and an edit that switches `auto_renew` off while sending new `rental_hours` that end past `term_start + term_mrl` is refused the same way.
* Shortening the request without switching `auto_renew` off in the same change is always accepted, and so is switching `auto_renew` off without new hours or with `rental_hours: null`. If the new `rental_hours` are already used up, the order ends about a minute after the change. To stop a rental right away, use [`cancel_order`](#id-9-cancel_order).
* `rental_hours: null` removes the requested limit: with `auto_renew` on, the order then runs until you cancel.
* From 60 seconds before the end of a term until the term has renewed or the order has ended, the change is refused with `renewal_in_progress`. Read the order again with [`my_orders`](#id-5-my_orders) and retry.
* On an order created before auto-renewal shipped, the first change sets `term_start` to the creation time and `term_mrl` to the order's `mrl`, so without `auto_renew` it cannot run past its original end.

**Headers**

| Field          | Type     | Mandatory | Description                |
| -------------- | -------- | --------- | -------------------------- |
| `auth`         | `string` | Yes       | API token                  |
| `Content-type` | `string` | Yes       | Must be `application/json` |

**Body**

| Field                  | Type            | Mandatory | Description                                                                                                                                                                                                                                     |
| ---------------------- | --------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `order_id`             | `int`           | Yes       | Unique order ID                                                                                                                                                                                                                                 |
| `rental_hours`         | `int` \| `null` | No        | New requested length in whole hours (1 to 3000), counted from the order's creation. `null` removes the requested limit. Omit it to keep the current value                                                                                       |
| `auto_renew`           | `bool`          | No        | Renew at the host's current price when the current term ends. Omit it to keep the current value. Turning it on is refused when the server's `auto_renew_allowed` is `false`                                                                     |
| `auto_renew_max_price` | `float`         | Depends   | Per-day price limit in the order's currency, above 0 and at most the marketplace's maximum price for that currency. Required when this change turns `auto_renew` on and the order has no limit yet; otherwise omit it to keep the current limit |

**Output**

| Field   | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `code`  | `int`    | Status code. `2` (HTTP 400) when the body has a wrong type, for example a missing or non-integer `order_id`, `rental_hours` that is neither a whole number nor `null`, a non-boolean `auto_renew` or a non-numeric `auto_renew_max_price`; this is checked before any error below                                                                                                                                                                                                                                                                                                                                                                                               |
| `error` | `string` | Present with code `6` (HTTP 200): `you_dont_own_this_order` (the order does not exist or is not yours), `order_not_active` (a spot or closed order, an order being cancelled, or one that ended while the change was being saved), `renewal_in_progress` (the current term ends within 60 seconds, or the order changed while the change was being saved; read the order again and retry), `invalid_rental_hours` (below 1 or above 3000), `rental_hours_exceeds_mrl` (see the rules above), `invalid_auto_renew` (`auto_renew` ends up on without a valid price limit), `auto_renew_not_allowed` (the change turns `auto_renew` on and the server does not allow auto-renewal) |

**Example**

**Input 1 (Keep renewing until cancelled):**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "order_id":12345,
    "rental_hours":null,
    "auto_renew":true,
    "auto_renew_max_price":30
}' 'https://api.clore.ai/v1/set_order_auto_renew'
```

**Output 1 (Keep renewing until cancelled):**

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

**Input 2 (Stop renewing, the order ends with its current term):**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "order_id":12345,
    "auto_renew":false
}' 'https://api.clore.ai/v1/set_order_auto_renew'
```

**Output 2 (Stop renewing, the order ends with its current term):**

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

Sent in the last 60 seconds of a term, the same request is refused until the order has renewed or ended:

```
{ "error": "renewal_in_progress", "code": 6 }
```

#### 17. `order_renewals` <a href="#id-17-order_renewals" id="id-17-order_renewals"></a>

**About**

Get the renewal history of your order: one row per renewal decision taken at a term end, renewed or declined, newest first, at most 1000 rows. An order that never reached a renewal decision returns an empty list, and the end at which an order stops because its requested hours are used up leaves no row. POST only; a GET answers code `4`.

**Headers**

| Field          | Type     | Mandatory | Description                |
| -------------- | -------- | --------- | -------------------------- |
| `auth`         | `string` | Yes       | API token                  |
| `Content-type` | `string` | Yes       | Must be `application/json` |

**Body**

| Field      | Type  | Mandatory | Description     |
| ---------- | ----- | --------- | --------------- |
| `order_id` | `int` | Yes       | Unique order ID |

**Output**

| Field                      | Type       | Description                                                                                                                                                                                                              |
| -------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `code`                     | `int`      | Status code. `2` (HTTP 400) when `order_id` is missing or not an integer                                                                                                                                                 |
| `error`                    | `string`   | `you_dont_own_this_order` with code `6` (HTTP 200) when the order does not exist or is not yours                                                                                                                         |
| `renewals`                 | `[]object` | Renewal decisions, newest first; present on success only                                                                                                                                                                 |
| `renewals[x].order_id`     | `int`      | Unique order ID                                                                                                                                                                                                          |
| `renewals[x].renewal_no`   | `int`      | The number this renewal has, or would have had, among the order's renewals, counting from 1                                                                                                                              |
| `renewals[x].outcome`      | `string`   | `renewed` or `declined`                                                                                                                                                                                                  |
| `renewals[x].reason`       | `string`   | Declined rows only: `price_above_cap`, `server_unlisted`, `host_disallowed`, `server_reserved` or `insufficient_balance` (see `orders[x].auto_renew_declined` in [`my_orders`](#id-5-my_orders))                         |
| `renewals[x].decided_at`   | `int`      | UNIX time of the decision, taken when the term had ended                                                                                                                                                                 |
| `renewals[x].applied_at`   | `int`      | UNIX time the renewal was confirmed to have taken effect. Absent on a decline and on a renewal decision that was not confirmed; a decision can stay unapplied when the order was cancelled or changed at the same moment |
| `renewals[x].old_price`    | `float`    | Per-day price of the term that ended                                                                                                                                                                                     |
| `renewals[x].new_price`    | `float`    | Per-day price of the new term, or on a decline the host's price that was declined; absent when no price could be computed                                                                                                |
| `renewals[x].cap`          | `float`    | Your per-day price limit when the decision was taken                                                                                                                                                                     |
| `renewals[x].term_seconds` | `int`      | Length of the new term in seconds; `0` on a decline                                                                                                                                                                      |
| `renewals[x].term_start`   | `int`      | UNIX time the new term starts (the end of the previous one); on a decline, the start of the term that ended                                                                                                              |
| `renewals[x].term_end`     | `int`      | UNIX time the new term ends; on a decline, the end of the term that ended                                                                                                                                                |

**Example**

**Input:**

```
curl -XPOST -H 'auth: b8qwqRAL5W7YDyDJeB4XANVvKndbrrPk' -H "Content-type: application/json" -d '{
    "order_id":12345
}' 'https://api.clore.ai/v1/order_renewals'
```

**Output:**

In this example the order renewed once at 24 per day, within its limit of 30. At the end of that term the host's price was 36, above the limit, so the renewal was declined and the order ended with that term.

```
{
  "renewals": [
    {
      "order_id": 12345,
      "renewal_no": 2,
      "outcome": "declined",
      "reason": "price_above_cap",
      "decided_at": 1792209661,
      "old_price": 24,
      "new_price": 36,
      "cap": 30,
      "term_seconds": 0,
      "term_start": 1792188060,
      "term_end": 1792209660
    },
    {
      "order_id": 12345,
      "renewal_no": 1,
      "outcome": "renewed",
      "decided_at": 1792188061,
      "applied_at": 1792188061,
      "old_price": 20,
      "new_price": 24,
      "cap": 30,
      "term_seconds": 21600,
      "term_start": 1792188060,
      "term_end": 1792209660
    }
  ],
  "code": 0
}
```


---

# 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://docs.clore.ai/for-hosts/api.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.
