# flavors (/docs/reference/api/flavors)

> Flavors are the named instance shapes of a VPS pool: vCPU, memory, disk and GPU count, plus the provider offer a provider pool creates. The pool's owner manages them, and tenants the pool is offered to can list them. An instance keeps the shape it was admitted with, so changing or deleting a flavor never changes a live instance. See [Flavors](/docs/guides/vps/flavors).



Flavors are the named instance shapes of a VPS pool: vCPU, memory, disk and GPU count, plus the provider offer a provider pool creates. The pool's owner manages them, and tenants the pool is offered to can list them. An instance keeps the shape it was admitted with, so changing or deleting a flavor never changes a live instance. See [Flavors](/docs/guides/vps/flavors).

All 4 methods are served by this release.

| Method              | Kind     | Authorization                             | Phase | Status     |
| ------------------- | -------- | ----------------------------------------- | ----- | ---------- |
| [`list`](#list)     | read     | `compute:flavors:read` @ `compute-pool`   | v0.3  | registered |
| [`create`](#create) | mutation | `compute:flavors:manage` @ `compute-pool` | v0.3  | registered |
| [`update`](#update) | mutation | `compute:flavors:manage` @ `compute-pool` | v0.3  | registered |
| [`delete`](#delete) | mutation | `compute:flavors:manage` @ `compute-pool` | v0.3  | registered |

## list [#list]

`POST /api/compute/flavors/list`

Returns the pool's flavors that are not archived, sorted by name.

The pool must be owned by or offered to the tenant; otherwise the call is `NOT_FOUND`.

* **Kind:** read
* **Authorization:** `compute:flavors:read` @ `compute-pool`
* **Module:** `vps`
* **Phase:** v0.3 (registered)

**Input**

| Field      | Type   | Required | Constraints                                                       |
| ---------- | ------ | -------- | ----------------------------------------------------------------- |
| `tenantId` | string | yes      | at most 128 characters; matches `^[A-Za-z0-9._:-]{1,128}$`        |
| `poolId`   | string | yes      | at most 57 characters; matches `^pool_[0-9a-hjkmnp-tv-z]{26,52}$` |

## create [#create]

`POST /api/compute/flavors/create`

Adds a flavor to a `vps-host` or `provider` pool the tenant owns and returns it at version 1.

* `gpus` defaults to 0. A flavor of a provider pool needs `offerId`, the provider offer it creates; without it the call is `INVALID_INPUT`.

* `placement` (hosted pools only; `INVALID_INPUT` on a provider pool) says where the guest lives on its host, and sandbox templates on the flavor inherit it:
  * `hugepages: '2Mi' | '1Gi'` backs guest memory with hugepages. These are booked from the host's hugepage pools instead of its memory, still charged to quota as `memoryGiB`, and never ballooned.
  * `numaAffine` keeps the vCPUs and memory on one NUMA node: the GPUs' node, or otherwise the least-loaded node with room for the memory.
  * `pinned` gives each vCPU a host CPU that no other pinned guest on the host has.
  * A host that cannot honour `numaAffine` or `pinned` still runs the guest, floating, and the instance carries a `PlacementDegraded` condition with the reason (`NoNumaTopology`, `NoNumaNodeFits`, `GpuNumaUnknown`, `NumaMemoryTooSmall` or `NotEnoughFreeCpus`).
  * Resizing to a flavor with a different `placement` is `UNSUPPORTED`.

* In a pool that overcommits memory (`policy.overcommit.memoryGiB` > 1), every guest gets a virtio balloon so the host can reclaim its free memory. The exceptions are hugepage-backed guests and guests with GPUs, whose memory is pinned. This needs no flavor field.

* `NOT_FOUND` when the tenant does not own the pool; `INVALID_STATE` when the pool is of another class.

* `CONFLICT` when the pool already has a flavor with that name, archived ones included.

* **Kind:** mutation

* **Authorization:** `compute:flavors:manage` @ `compute-pool`

* **Module:** `vps`

* **Phase:** v0.3 (registered)

**Input**

| Field                  | Type                | Required | Constraints                                                       |
| ---------------------- | ------------------- | -------- | ----------------------------------------------------------------- |
| `tenantId`             | string              | yes      | at most 128 characters; matches `^[A-Za-z0-9._:-]{1,128}$`        |
| `poolId`               | string              | yes      | at most 57 characters; matches `^pool_[0-9a-hjkmnp-tv-z]{26,52}$` |
| `name`                 | string              | yes      | at most 63 characters; matches `^[a-z0-9][a-z0-9._-]{0,62}$`      |
| `vcpu`                 | integer             | yes      | 1-1024                                                            |
| `memoryGiB`            | integer             | yes      | 1-16384                                                           |
| `diskGiB`              | integer             | yes      | 1-65536                                                           |
| `gpus`                 | integer             |          | 0-16; default `0`                                                 |
| `offerId`              | string              |          | 1-128 characters                                                  |
| `placement`            | object              |          |                                                                   |
| `placement.numaAffine` | boolean             |          |                                                                   |
| `placement.pinned`     | boolean             |          |                                                                   |
| `placement.hugepages`  | one of `2Mi`, `1Gi` |          |                                                                   |

## update [#update]

`POST /api/compute/flavors/update`

Replaces the shape of the named flavor and increments its version; an archived flavor becomes active again.

The input is the full shape, as for `create`. An omitted `offerId` keeps the stored one. Instances already admitted keep their old shape; only new instances and resizes use the new one. The call is `NOT_FOUND` when the tenant does not own the pool or the flavor does not exist.

* **Kind:** mutation
* **Authorization:** `compute:flavors:manage` @ `compute-pool`
* **Module:** `vps`
* **Phase:** v0.3 (registered)

**Input**

| Field                  | Type                | Required | Constraints                                                       |
| ---------------------- | ------------------- | -------- | ----------------------------------------------------------------- |
| `tenantId`             | string              | yes      | at most 128 characters; matches `^[A-Za-z0-9._:-]{1,128}$`        |
| `poolId`               | string              | yes      | at most 57 characters; matches `^pool_[0-9a-hjkmnp-tv-z]{26,52}$` |
| `name`                 | string              | yes      | at most 63 characters; matches `^[a-z0-9][a-z0-9._-]{0,62}$`      |
| `vcpu`                 | integer             | yes      | 1-1024                                                            |
| `memoryGiB`            | integer             | yes      | 1-16384                                                           |
| `diskGiB`              | integer             | yes      | 1-65536                                                           |
| `gpus`                 | integer             |          | 0-16; default `0`                                                 |
| `offerId`              | string              |          | 1-128 characters                                                  |
| `placement`            | object              |          |                                                                   |
| `placement.numaAffine` | boolean             |          |                                                                   |
| `placement.pinned`     | boolean             |          |                                                                   |
| `placement.hugepages`  | one of `2Mi`, `1Gi` |          |                                                                   |

## delete [#delete]

`POST /api/compute/flavors/delete`

Deletes the named flavor, or archives it when any instance, deleted ones included, still references it; returns `deleted` and `archived` to say which.

An archived flavor disappears from `list` and can no longer be used to create or resize instances. `update` makes it active again. The call is `NOT_FOUND` when the tenant does not own the pool or the flavor does not exist.

* **Kind:** mutation
* **Authorization:** `compute:flavors:manage` @ `compute-pool`
* **Module:** `vps`
* **Phase:** v0.3 (registered)

**Input**

| Field      | Type   | Required | Constraints                                                       |
| ---------- | ------ | -------- | ----------------------------------------------------------------- |
| `tenantId` | string | yes      | at most 128 characters; matches `^[A-Za-z0-9._:-]{1,128}$`        |
| `poolId`   | string | yes      | at most 57 characters; matches `^pool_[0-9a-hjkmnp-tv-z]{26,52}$` |
| `name`     | string | yes      | at most 63 characters; matches `^[a-z0-9][a-z0-9._-]{0,62}$`      |
