# API How-Tos

The Cloud API lets you manage Cloud Cubes resources programmatically using conventional HTTP requests. All the functionality available in the IONOS Cloud Data Center Designer is also available through the API.

You can use the API to create, destroy, and retrieve information about your Cubes. You can also use the API to suspend or resume your Cubes.

However, not all actions are shared between Dedicated Core Servers and Cloud Cubes. Since Cubes come with direct-attached storage, a composite call is required for setup.

Furthermore, when provisioning Cubes, Templates must be used. Templates will not be compatible with Servers that still support full flex configuration.

#### APIs & SDKs

| [<mark style="color:blue;">Cloud API (v.6)</mark>](https://api.ionos.com/docs/cloud/v6/)                                    | Cloud API outlines all required actions.                                                                                                                                                                                                                                                                                                                                                              |
| --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [<mark style="color:blue;">Cloud API SDK</mark>](https://docs.ionos.com/reference/software-development-kits/cloud-api-sdks) | [<mark style="color:blue;">GO</mark>](https://docs.ionos.com/golang-sdk/) \| [<mark style="color:blue;">Python</mark>](https://docs.ionos.com/python-sdk/) \| [<mark style="color:blue;">Java</mark>](https://docs.ionos.com/java-sdk/) \| [<mark style="color:blue;">Ruby</mark>](https://docs.ionos.com/ruby-sdk/) \| [<mark style="color:blue;">NodeJS</mark>](https://docs.ionos.com/nodejs-sdk/) |

### Retrieving available Templates and Template details

## Retrieve Template list

<mark style="color:blue;">`GET`</mark> `https://api.ionos.com/docs/cloud/v6/#tag/Templates/cloudapi/v6/templates`

This method retrieves a list of configuration templates that are currently available. Instances have a fixed configuration of vCPU, RAM and direct-attached storage size.

#### Path Parameters

| Name      | Type   | Description                                    |
| --------- | ------ | ---------------------------------------------- |
| v6        | string | The API version                                |
| templates | string | Template attributes: ID, metadata, properties. |

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

```
```

{% endtab %}
{% endtabs %}

## Retrieve Template details

<mark style="color:blue;">`GET`</mark> `https://api.ionos.com/docs/cloud/v6/#tag/Templates/cloudapi/v6/templates?depth=1`

Retrieves Template information. Refine your request by adding the optional query parameter

`depth`

. The response will show a template's ID, number of cores, ram and storage size.

#### Path Parameters

| Name      | Type   | Description                                    |
| --------- | ------ | ---------------------------------------------- |
| v6        | string | The API version.                               |
| templates | string | Template attributes: ID, metadata, properties. |

#### Query Parameters

| Name  | Type    | Description                               |
| ----- | ------- | ----------------------------------------- |
| depth | integer | Template detail depth. Default value = 0. |

{% tabs %}
{% tab title="200 Successful response" %}

```
{
    "id": "templates",
    "type": "collection",
    "href": "https://api.ionos.com/cloudapi/v6/templates",
    "items": [
        {
            "id": "5e98b425-1887-44e4-b782-a654bfbe7eaa",
            "type": "template",
            "href": "https://api.ionos.com/cloudapi/v6/templates/5e98b425-1887-44e4-b782-a654bfbe7eaa",
            "metadata": {
                "etag": "106988fd270d48ffd1734a210801a33d",
                "createdDate": "2021-02-13T17:07:39Z",
                "createdBy": "[UNKNOWN]",
                "createdByUserId": "[UNKNOWN]",
                "lastModifiedDate": "2021-08-10T10:11:45Z",
                "lastModifiedBy": "[UNKNOWN]",
                "lastModifiedByUserId": "[UNKNOWN]",
                "state": "AVAILABLE"
            },
            "properties": {
                "name": "CUBES XL",
                "cores": 6,
                "ram": 16384,
                "storageSize": 320
            }
        },
        {
            "id": "99d022bd-55ea-4af1-9ba7-6d4174d9fc22",
            "type": "template",
            "href": "https://api.ionos.com/cloudapi/v6/templates/99d022bd-55ea-4af1-9ba7-6d4174d9fc22",
            "metadata": {
                "etag": "2fd7e4e39bbbb7b33920bf4d7b5509a6",
                "createdDate": "2021-02-13T17:06:25Z",
                "createdBy": "[UNKNOWN]",
                "createdByUserId": "[UNKNOWN]",
                "lastModifiedDate": "2021-08-10T10:11:35Z",
                "lastModifiedBy": "[UNKNOWN]",
                "lastModifiedByUserId": "[UNKNOWN]",
                "state": "AVAILABLE"
            },
            "properties": {
                "name": "CUBES L",
                "cores": 4,
                "ram": 8192,
                "storageSize": 160
            }
        },
        {
            "id": "5ae1bfbd-05f2-47f5-a736-eaca3dcce41b",
            "type": "template",
            "href": "https://api.ionos.com/cloudapi/v6/templates/5ae1bfbd-05f2-47f5-a736-eaca3dcce41b",
            "metadata": {
                "etag": "6e68d67158a63d6d644a7c680342b26f",
                "createdDate": "2021-02-13T17:03:51Z",
                "createdBy": "[UNKNOWN]",
                "createdByUserId": "[UNKNOWN]",
                "lastModifiedDate": "2021-08-10T10:10:49Z",
                "lastModifiedBy": "[UNKNOWN]",
                "lastModifiedByUserId": "[UNKNOWN]",
                "state": "AVAILABLE"
            },
            "properties": {
                "name": "CUBES S",
                "cores": 1,
                "ram": 2048,
                "storageSize": 50
            }
        },
        {
            "id": "15c6dd2f-02d2-4987-b439-9a58dd59ecc3",
            "type": "template",
            "href": "https://api.ionos.com/cloudapi/v6/templates/15c6dd2f-02d2-4987-b439-9a58dd59ecc3",
            "metadata": {
                "etag": "4ff2f8ebb363005b447edb38563405a6",
                "createdDate": "2021-02-13T17:02:13Z",
                "createdBy": "[UNKNOWN]",
                "createdByUserId": "[UNKNOWN]",
                "lastModifiedDate": "2021-08-10T10:11:03Z",
                "lastModifiedBy": "[UNKNOWN]",
                "lastModifiedByUserId": "[UNKNOWN]",
                "state": "AVAILABLE"
            },
            "properties": {
                "name": "CUBES XS",
                "cores": 1,
                "ram": 1024,
                "storageSize": 30
            }
        },
        {
            "id": "56ce4e71-b03a-42b2-85be-9a4520aa40be",
            "type": "template",
            "href": "https://api.ionos.com/cloudapi/v6/templates/56ce4e71-b03a-42b2-85be-9a4520aa40be",
            "metadata": {
                "etag": "f528ce3bcba9ff1332d7c181f221984c",
                "createdDate": "2021-02-13T17:08:50Z",
                "createdBy": "[UNKNOWN]",
                "createdByUserId": "[UNKNOWN]",
                "lastModifiedDate": "2021-08-10T10:11:57Z",
                "lastModifiedBy": "[UNKNOWN]",
                "lastModifiedByUserId": "[UNKNOWN]",
                "state": "AVAILABLE"
            },
            "properties": {
                "name": "CUBES XXL",
                "cores": 8,
                "ram": 32768,
                "storageSize": 640
            }
        },
        {
            "id": "7f8dfdb3-594b-4ae2-ae2e-a9dfcbf05f74",
            "type": "template",
            "href": "https://api.ionos.com/cloudapi/v6/templates/7f8dfdb3-594b-4ae2-ae2e-a9dfcbf05f74",
            "metadata": {
                "etag": "fbb4194b718ce3e456437dbc55405273",
                "createdDate": "2021-02-13T17:05:17Z",
                "createdBy": "[UNKNOWN]",
                "createdByUserId": "[UNKNOWN]",
                "lastModifiedDate": "2021-08-10T10:11:22Z",
                "lastModifiedBy": "[UNKNOWN]",
                "lastModifiedByUserId": "[UNKNOWN]",
                "state": "AVAILABLE"
            },
            "properties": {
                "name": "CUBES M",
                "cores": 2,
                "ram": 4096,
                "storageSize": 80
            }
        }
    ]
}
```

{% endtab %}
{% endtabs %}

### Creating instances with composite calls

A composite call doesn't only configure a single instance but also defines additional devices. This is required because a Cloud Cube must include a direct-attached storage device. An instance cannot be provisioned and then mounted with a direct-attached storage volume. Composite calls are used to execute a series of [REST API](https://en.wikipedia.org/wiki/Representational_state_transfer) requests into a single API call. You can use the output of one request as the input for a subsequent request.

The payload of a composite call to configure a Cubes instance is different from that of a `POST` request to create an enterprise server. In a single request you can create a new instance, as well as its direct-attached storage device and image (public image, private image, or snapshot). When the request is processed, a Cubes instance is created and the direct-attached storage is mounted automatically.

## Create an instance&#x20;

<mark style="color:green;">`POST`</mark> `https://api.ionos.com/cloudapi/v6/datacenter/{datacenterId}/servers`

This method creates an instance in a specific data center.

\\

Replace {datacenterID} with the unique ID of your data center. Your Cloud Cube will be provisioned in this location.

#### Path Parameters

| Name         | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| v6           | string |                                   |
| datacenter   | string | The API version.                  |
| datacenterId | string | The unique ID of the data center. |
| servers      | string |                                   |

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

```
```

{% endtab %}
{% endtabs %}

## Suspend an instance

<mark style="color:green;">`POST`</mark> `https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/suspend`

This method suspends an instance.

#### Path Parameters

| Name         | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| v6           | string | The API version.                  |
| datacenterId | string | The unique ID of the data center. |
| serverId     | string | The unique ID of the instance.    |

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

```
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
This does not destroy the instance. Used resources will be billed.
{% endhint %}

### Setup, Resume and Delete

## Resume instance

<mark style="color:green;">`POST`</mark> `https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/resume`

This method resumes a suspended instance.

#### Path Parameters

| Name         | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| v6           | string | The API version.                  |
| datacenterId | string | The unique ID of the data center. |
| serverId     | string | The unique ID of the instance.    |

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

```
```

{% endtab %}
{% endtabs %}

## Delete instance

<mark style="color:red;">`DELETE`</mark> `https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}`

This method deletes an instance.

#### Path Parameters

| Name         | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| v6           | string | The API version.                  |
| datacenterID | string | The unique ID of the data center. |
| serverID     | string | The unique ID of the instance.    |

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

```
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
Deleting an instance also deletes the direct-attached storage NVMe volume. You should make a snapshot first in case you need to recreate the instance with the appropriate data device later.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/cloud/~/revisions/1AlFSZBNMIBgs7fiOwFD/compute/cloud-cubes/api-how-tos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
