# Template


<style>
  span[class^="pill-"] {
    color: white;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 0.6em;
    vertical-align: middle;
    margin-right: 12px;
    font-family: sans-serif;
    font-weight: bold;
    display: inline-block;
    line-height: 1;
  }
  span.pill-GET { background-color: #61affe; }
  span.pill-POST { background-color: #49cc90; }
  span.pill-PUT { background-color: #fca130; }
  span.pill-DELETE { background-color: #f93e3e; }
  span.pill-PATCH { background-color: #50e3c2; }
  span[class^="pill-"]:after {
    content: attr(data-label);
    font-size: 0.9rem;
  }
</style>

Templates contain the OS and the initial setup of a Compute instance.

[Read more](https://www.exoscale.com/templates/)

## <span data-label="GET" class="pill-GET"></span>get-template

Retrieve Template details

```
GET /template/{id}
```

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `id` | `path` | Must be a valid UUID. |

### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `application-consistent-snapshot-enabled` | boolean | Template with Qemu Guest Agent installed for application consistent snapshot |
| `boot-mode` | string | Boot mode (default: legacy)<br/><br/>Allowed values: `legacy`, `uefi`. |
| `build` | string | Template build |
| `checksum` | string | Template MD5 checksum |
| `created-at` | string | Template creation date<br/><br/>ISO 8601 date-time. |
| `default-user` | string | Template default user<br/><br/>Min length: `1`. Max length: `255`. |
| `description` | string | Template description<br/><br/>Max length: `255`. |
| `family` | string | Template family |
| `id` | string | Template ID<br/><br/>Must be a valid UUID. |
| `maintainer` | string | Template maintainer |
| `name` | string | Template name<br/><br/>Min length: `1`. Max length: `255`. |
| `password-enabled` | boolean | Enable password-based login |
| `size` | integer | Template size<br/><br/>Min: `0`. |
| `ssh-key-enabled` | boolean | Enable SSH key-based login |
| `url` | string | Template source URL |
| `version` | string | Template version |
| `visibility` | string | Template visibility<br/><br/>Allowed values: `private`, `public`. |
| `zones` | array of [Zone Name](/reference/api/_schemas/zone-name/) | Zones availability |

<details>
<summary>Example output</summary>

```json
{
  "application-consistent-snapshot-enabled": true,
  "boot-mode": "legacy",
  "build": "string",
  "checksum": "string",
  "created-at": "2024-01-01T12:00:00Z",
  "default-user": "string",
  "description": "string",
  "family": "string",
  "id": "string",
  "maintainer": "string",
  "name": "string",
  "password-enabled": true,
  "size": 0,
  "ssh-key-enabled": true,
  "url": "string",
  "version": "string",
  "visibility": "private",
  "zones": [
    "ch-dk-2"
  ]
}
```
</details>


SDK reference for `get-template`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.GetTemplate) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.get_template) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#getTemplate(java.util.UUID))

[CLI](https://community.exoscale.com/tools/command-line-interface/): `exo api get-template`

## <span data-label="PUT" class="pill-PUT"></span>update-template

Update template attributes

```
PUT /template/{id}
```

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `id` | `path` | Must be a valid UUID. |

### Request body

Content-Type: `application/json`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `description` | string | no | Template Description<br/><br/>Max length: `255`. |
| `name` | string | no | Template name<br/><br/>Min length: `1`. Max length: `255`. |

<details>
<summary>Example</summary>

```json
{
  "description": "string",
  "name": "string"
}
```
</details>


### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `id` | string | Operation ID<br/><br/>Must be a valid UUID. |
| `message` | string | Operation message |
| `reason` | string | Operation failure reason<br/><br/>Allowed values: `incorrect`, `unknown`, `unavailable`, `forbidden`, `busy`, `fault`, `partial`, `not-found`, `interrupted`, `unsupported`, `conflict`. |
| `reference` | [Reference](/reference/api/_schemas/operation/#reference) | Related resource reference |
| `state` | string | Operation status<br/><br/>Allowed values: `failure`, `pending`, `success`, `timeout`. |

<details>
<summary>Example output</summary>

```json
{
  "id": "string",
  "message": "string",
  "reason": "incorrect",
  "reference": {
    "command": "string",
    "id": "string",
    "link": "string"
  },
  "state": "failure"
}
```
</details>


SDK reference for `update-template`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.UpdateTemplate) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.update_template) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#updateTemplate(java.util.UUID,com.exoscale.sdk.model.UpdateTemplateRequest))

[CLI](https://community.exoscale.com/tools/command-line-interface/): `exo api update-template`

## <span data-label="DELETE" class="pill-DELETE"></span>delete-template

Delete a Template

```
DELETE /template/{id}
```

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `id` | `path` | Must be a valid UUID. |

### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `id` | string | Operation ID<br/><br/>Must be a valid UUID. |
| `message` | string | Operation message |
| `reason` | string | Operation failure reason<br/><br/>Allowed values: `incorrect`, `unknown`, `unavailable`, `forbidden`, `busy`, `fault`, `partial`, `not-found`, `interrupted`, `unsupported`, `conflict`. |
| `reference` | [Reference](/reference/api/_schemas/operation/#reference) | Related resource reference |
| `state` | string | Operation status<br/><br/>Allowed values: `failure`, `pending`, `success`, `timeout`. |

<details>
<summary>Example output</summary>

```json
{
  "id": "string",
  "message": "string",
  "reason": "incorrect",
  "reference": {
    "command": "string",
    "id": "string",
    "link": "string"
  },
  "state": "failure"
}
```
</details>


SDK reference for `delete-template`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.DeleteTemplate) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.delete_template) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#deleteTemplate(java.util.UUID))

[CLI](https://community.exoscale.com/tools/command-line-interface/): `exo api delete-template`


---

## Other Operations

## <span data-label="POST" class="pill-POST"></span>copy-template

Copy a Template from a zone to another

```
POST /template/{id}
```

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `id` | `path` | Must be a valid UUID. |

### Request body

Content-Type: `application/json`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `target-zone` | [Zone](/reference/api/_schemas/zone/) | **yes** | Target Zone name |

<details>
<summary>Example</summary>

```json
{
  "target-zone": {
    "api-endpoint": "string",
    "name": "ch-dk-2",
    "sos-endpoint": "string"
  }
}
```
</details>


### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `id` | string | Operation ID<br/><br/>Must be a valid UUID. |
| `message` | string | Operation message |
| `reason` | string | Operation failure reason<br/><br/>Allowed values: `incorrect`, `unknown`, `unavailable`, `forbidden`, `busy`, `fault`, `partial`, `not-found`, `interrupted`, `unsupported`, `conflict`. |
| `reference` | [Reference](/reference/api/_schemas/operation/#reference) | Related resource reference |
| `state` | string | Operation status<br/><br/>Allowed values: `failure`, `pending`, `success`, `timeout`. |

<details>
<summary>Example output</summary>

```json
{
  "id": "string",
  "message": "string",
  "reason": "incorrect",
  "reference": {
    "command": "string",
    "id": "string",
    "link": "string"
  },
  "state": "failure"
}
```
</details>


SDK reference for `copy-template`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.CopyTemplate) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.copy_template) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#copyTemplate(java.util.UUID,com.exoscale.sdk.model.CopyTemplateRequest))

[CLI](https://community.exoscale.com/tools/command-line-interface/): `exo api copy-template`

## <span data-label="POST" class="pill-POST"></span>register-template

Register a Template

```
POST /template
```

### Request body

Content-Type: `application/json`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | **yes** | Template MD5 checksum<br/><br/>Min length: `1`. |
| `name` | string | **yes** | Template name<br/><br/>Min length: `1`. Max length: `255`. |
| `password-enabled` | boolean | **yes** | Enable password-based login |
| `ssh-key-enabled` | boolean | **yes** | Enable SSH key-based login |
| `url` | string | **yes** | Template source URL<br/><br/>Min length: `1`. |
| `application-consistent-snapshot-enabled` | boolean | no | Template with support for Application Consistent Snapshots |
| `boot-mode` | string | no | Boot mode (default: legacy)<br/><br/>Allowed values: `legacy`, `uefi`. |
| `build` | string | no | Template build<br/><br/>Min length: `1`. Max length: `255`. |
| `default-user` | string | no | Template default user<br/><br/>Min length: `1`. Max length: `255`. |
| `description` | string | no | Template description<br/><br/>Max length: `255`. |
| `maintainer` | string | no | Template maintainer<br/><br/>Min length: `1`. Max length: `255`. |
| `size` | integer | no | Template size<br/><br/>Min: `0`. |
| `version` | string | no | Template version<br/><br/>Min length: `1`. Max length: `255`. |

<details>
<summary>Example</summary>

```json
{
  "application-consistent-snapshot-enabled": true,
  "boot-mode": "legacy",
  "build": "string",
  "checksum": "string",
  "default-user": "string",
  "description": "string",
  "maintainer": "string",
  "name": "string",
  "password-enabled": true,
  "size": 0,
  "ssh-key-enabled": true,
  "url": "string",
  "version": "string"
}
```
</details>


### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `id` | string | Operation ID<br/><br/>Must be a valid UUID. |
| `message` | string | Operation message |
| `reason` | string | Operation failure reason<br/><br/>Allowed values: `incorrect`, `unknown`, `unavailable`, `forbidden`, `busy`, `fault`, `partial`, `not-found`, `interrupted`, `unsupported`, `conflict`. |
| `reference` | [Reference](/reference/api/_schemas/operation/#reference) | Related resource reference |
| `state` | string | Operation status<br/><br/>Allowed values: `failure`, `pending`, `success`, `timeout`. |

<details>
<summary>Example output</summary>

```json
{
  "id": "string",
  "message": "string",
  "reason": "incorrect",
  "reference": {
    "command": "string",
    "id": "string",
    "link": "string"
  },
  "state": "failure"
}
```
</details>


SDK reference for `register-template`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.RegisterTemplate) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.register_template) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#registerTemplate(com.exoscale.sdk.model.RegisterTemplateRequest))

[CLI](https://community.exoscale.com/tools/command-line-interface/): `exo api register-template`

## <span data-label="GET" class="pill-GET"></span>list-templates

List Templates

```
GET /template
```

### Query parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `visibility` | `query` | no |  |
| `family` | `query` | no |  |

### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `templates` | array of [Instance template](/reference/api/_schemas/template/) |  |

<details>
<summary>Example output</summary>

```json
{
  "templates": [
    {
      "application-consistent-snapshot-enabled": true,
      "boot-mode": "legacy",
      "build": "string",
      "checksum": "string",
      "created-at": "2024-01-01T12:00:00Z",
      "default-user": "string",
      "description": "string",
      "family": "string",
      "id": "string",
      "maintainer": "string",
      "name": "string",
      "password-enabled": true,
      "size": 0,
      "ssh-key-enabled": true,
      "url": "string",
      "version": "string",
      "visibility": "private",
      "zones": [
        "ch-dk-2"
      ]
    }
  ]
}
```
</details>


SDK reference for `list-templates`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.ListTemplates) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.list_templates) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#listTemplates(java.lang.String,java.lang.String))

[CLI](https://community.exoscale.com/tools/command-line-interface/): `exo api list-templates`


