Logo
OpenScaler
API DocumentationBlock Storage

Create volume

POST
/v1/volumes

Create a new block storage volume and attach it to the specified VM.

Authorization

bearer_auth
AuthorizationBearer <token>

OAuth Authentication

OpenScaler API uses OAuth, a standard for secure authorization. To access the API, obtain a token via the OpenScaler Platform.

Use the access_token in the Authorization header for requests:

Authorization: Bearer <token>

Always keep your token secure and do not share it with anyone.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Request body for creating a new block storage volume.

Response Body

application/json

application/json

text/pain

application/json

application/json

curl -X POST "https://example.com/v1/volumes" \  -H "Content-Type: application/json" \  -d '{    "name": "my-volume",    "description": "This is a test volume",    "project_id": "default",    "sizeGB": 10,    "vm_id": "cc3ccab2-0ae2-11ef-9136-6a0922f6458b",    "filesystem_type": "ext4",    "filesystem_label": "label-xyz"  }'
{  "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",  "user_id": "user-abc123",  "project_id": "default",  "region": "alg1",  "name": "my-volume",  "description": "Block store for examples",  "sizeGB": 10,  "filesystem_type": "ext4",  "filesystem_label": "label-xyz",  "created_at": "2020-03-02T17:00:49Z",  "attached_vm_id": "cc3ccab2-0ae2-11ef-9136-6a0922f6458b"}
{  "errors": [    {      "message": "'vcpus' field must be an integer",      "field": "resource_id"    }  ]}
"Access denied"
{  "errors": [    {      "message": "User not initialized (missing required fields in token), please init user by sending POST request to `/v1/init` then refresh your token\n"    }  ]}
{  "errors": [    {      "message": "VM with ID 23 not found"    }  ]}