---
title: "Create volume"
method: POST
path: "/v1/volumes"
tags: ["Volumes"]
---

# Create volume

`POST /v1/volumes`

## Request

- Base URL: `https://api.emma.ms/external`
- URL: `https://api.emma.ms/external/v1/volumes`
- Auth: HTTP bearer

This method creates a volume according to the specified parameters.
To create a volume, follow these steps:
1. Select a data center using the `/v1/data-centers` endpoint. The data center determines the provider and location of the volume.
2. Select an available configuration for the volume using the `/v1/volumes-configs` endpoint.
3. (optional) Specify the `attachedToId` field with existing virtual machine id to attach new volume to this virtual machine

## Request body

- VolumeCreate
  - `dataCenterId` string, required: ID of the data center
  - `volumeGb` integer, required: Capacity of the volume in gigabytes
  - `volumeType` 'hdd' | 'ssd' | 'ssd-plus', required: Volume type
  - `attachedToId` integer: Target virtual machine for attaching the volume

## Response `200`

Volume created

- Volume
  - `id` integer: Volume ID
  - `name` string: Volume name
  - `attachedToId` integer: Compute instance ID that the volume is currently attached to
  - `projectId` integer: Project ID
  - `sizeGb` integer: Volume size in gigabytes
  - `type` 'hdd' | 'ssd' | 'ssd-plus': Volume type
  - `isSystem` boolean: Indicates whether the volume contains OS or not
  - `status` 'DRAFT' | 'BUSY' | 'AVAILABLE' | 'ACTIVE' | 'FAILED' | 'DELETED': Status of the volume
  - `provider` object
    - `id` integer: ID of the cloud provider
    - `name` string: Name of the cloud provider
  - `location` object
    - `id` integer: ID of the data center location
    - `name` string: Name of the data center location (city or state)
    - `country` string: Country of the data center location
    - `continent` string: Name of the geographical continent
    - `region` string: Name of the geographical region
    - `latitude` number, double: Approximate latitude of the geographical location
    - `longitude` number, double: Approximate longitude of the geographical location
  - `dataCenter` object
    - `id` string: Data center ID
    - `name` string: Data center name
    - `providerId` integer: ID of the cloud provider
    - `providerName` string: Name of the cloud provider
    - `locationId` integer: ID of the data center location
    - `locationName` string: Name of the data center location
  - `createdAt` string: Date and time when the volume was created
  - `createdByName` string: Name of the user who created the volume
  - `createdById` integer: ID of the user who created the volume
  - `modifiedAt` string: Date and time when the volume was last edited
  - `modifiedByName` string: Name of the user who last edited the volume
  - `modifiedById` integer: ID of the user who last edited the volume
  - `cost` object
    - `unit` string: Cost period
    - `currency` string: Currency of cost
    - `price` number: Cost of the volume for the period
  - `deviceIdentifier` string, nullable: Device identifier of the volume as seen by the operating system

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `403`: Forbidden - Access is denied
- `422`: Unprocessable entity
- `500`: Internal server error

---

[API](https://skmtc.dev/emma/apis/public-emma-api.md) - [All operations](https://skmtc.dev/emma/apis/public-emma-api/llms.txt) - [OpenAPI document](https://skmtc.dev/emma/apis/public-emma-api/revisions/9e55f0920078?raw)
