# Create an Instance

You can create an instance in a specific data center with a composite call. A composite call doesn't only configure a single instance but also defines additional devices. This is required because a 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 [<mark style="color:blue;">REST API</mark>](https://api.ionos.com/docs/cloud/v6/#tag/Servers)requests into a single API call. You can use the output of one request as the input for a subsequent request.

{% hint style="info" %}
The payload of a composite call to configure a Cubes instance differs from that of a POST request to create an enterprise server. In a single request, you can create a new instance and its direct-attached storage device and image ([<mark style="color:blue;">public images</mark>](/cloud/backup-and-storage/images-snapshots/public-images.md), [<mark style="color:blue;">private images</mark>](/cloud/backup-and-storage/images-snapshots/private-images.md), or [<mark style="color:blue;">snapshots</mark>](/cloud/backup-and-storage/images-snapshots/snapshots.md)). When the request is processed, a Cubes instance is created and the direct-attached storage is mounted automatically.
{% endhint %}

## Endpoint

Use the following endpoint for Cubes: `https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers`

## Request

{% hint style="info" %}
**Note:** The following request contains sample values. Remember to replace them with the relevant information.
{% endhint %}

```bash
curl -X 'POST' \
  'https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers' \
  -H 'accept: application/json'
```

{% tabs %}
{% tab title="Path Parameters" %}

{% endtab %}

{% tab title="undefined" %}
To make authenticated requests to the API, the following fields are mandatory in the request header:
{% endtab %}
{% endtabs %}

| **Name**       | **Type** | **Description**            |
| -------------- | :------: | -------------------------- |
| `datacenterId` |  string  | The ID of the data center. |
| `serverId`     |  string  | The ID of the Cube.        |

## Response

A **202** message confirms that the instance is created.

```json
{
  "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
  "type": "server",
  "href": "<RESOURCE-URI>",
  "metadata": {
    "etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
    "createdDate": "2015-12-04T14:34:09.809Z",
    "createdBy": "user@example.com",
    "createdByUserId": "user@example.com",
    "lastModifiedDate": "2015-12-04T14:34:09.809Z",
    "lastModifiedBy": "user@example.com",
    "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
    "state": "AVAILABLE"
  },
  "properties": {
    "templateUuid": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
    "name": "My resource",
    "hostname": "myHostname",
    "cores": 4,
    "ram": 4096,
    "availabilityZone": "AUTO",
    "vmState": "RUNNING",
    "bootCdrom": {
      "id": "string",
      "type": "resource",
      "href": "<RESOURCE-URI>"
    },
    "bootVolume": {
      "id": "string",
      "type": "resource",
      "href": "<RESOURCE-URI>"
    },
    "cpuFamily": "INTEL_ICELAKE",
    "type": "CUBE",
    "nicMultiQueue": true
  },
  "entities": {
        "volumes": {
            "items": [
                {
                    "properties": {
                        "name": "My resource",
                        "type": "DAS",
                        "licenceType": "LINUX"
                    }
                }
            ]
        }
    }
}

```


---

# 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/compute-services/cubes/api-how-tos/create-an-instance.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.
