Skip to content

Create a volume

POST/v1/volumes

Queues a new, unattached volume and returns 202 Accepted with the operation_id of the create operation. The volume starts in creating and becomes available when the operation succeeds. Then attach it to a VM.

Things to know:

  • size_gib must be between 1 and 1024.
  • Volume names do not have to be unique.
  • A volume that is not yet marked formatted is formatted with its filesystem the first time it is attached.
  • The X-Idempotency header is optional. If you repeat a request with a key already used for a volume create with the same name (compared by slug), the original operation is returned with 200 OK, is_replay: true and the X-Idempotency-Replay header, and nothing new is queued. The same key with a different name returns 409 (action: idempotency_key_reused). The replay is checked before billing and validation, so a retry still gets the original operation after the account became past due.

Authentication

Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.

Headers

X-Workspace-SlugstringRequired

Slug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.

X-Idempotencystring

Optional unique key for this request, such as a UUID. Leading and trailing spaces are trimmed. If the key was already used for the same action (and the same volume, or for a create the same name), the original operation is returned with 200 OK, is_replay: true and the X-Idempotency-Replay header, and nothing new is queued. The replay is checked before the volume's current state, so a retry after the first request finished still gets the original result. If the key was used for any other operation in the workspace, including VM, database or snapshot operations, the request is rejected with 409 and action: idempotency_key_reused.

Request body

namestringRequired

Display name of the volume. Leading and trailing spaces are trimmed.

descriptionstring

Optional free-text description. Leading and trailing spaces are trimmed.

size_gibintegerRequired

Size of the volume in GiB.

min 1 · max 1024

zone_slugstring

Zone to create the volume in. Case-insensitive. Defaults to olas-closet, currently the only zone. The volume can only be attached to VMs in the same zone.

Default olas-closet

filesystemstring

Filesystem to format the volume with. Case-insensitive.

Default ext4One ofext4xfs

formatboolean

Ask the provisioner to format the volume when it is created. Whatever you send, a volume that is not yet marked formatted is formatted on its first attach.

Default false

Response

202

The create operation was queued.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

UID of the queued (or replayed) operation. Pass it to Get an operation.

volumeobjectRequired
Show attributes
uidstringRequired

Unique identifier of the volume.

namestringRequired

Display name of the volume.

slugstringRequired

URL-friendly form of the name. Not necessarily unique.

descriptionstring

Free-text description. Omitted when empty.

statusstringRequired

Lifecycle state. available volumes can be attached, in-use volumes are attached to the VM in vm_uid. failed means creating or deleting the volume failed. See last_failure. deleted only appears in an idempotent replay of a delete.

One ofcreatingavailableattachingin-usedetachingdeletingdeletedfailed

zone_slugstringRequired

Zone the volume lives in.

size_gibintegerRequired

Size of the volume in GiB.

filesystemstringRequired

Filesystem the volume is formatted with.

One ofext4xfs

formattedbooleanRequired

true once the volume has been formatted, which happens on its first successful attach.

vm_uidstring

UID of the VM the volume is attached to or being attached to. Omitted when detached.

vm_namestring

Name of that VM. Omitted when detached or when the VM cannot be found.

device_namestring

Block device inside the VM, as reported by the guest agent. Omitted until reported.

mount_pathstring

Where the volume is mounted inside the VM, under /mnt/rumpty/, as reported by the guest agent. Omitted until reported.

usageobject

Filesystem usage reported by the VM's guest agent. Omitted until the agent has reported a sample for the mounted volume. The last sample is kept after the volume is detached.

Show attributes
total_bytesintegerRequired

Filesystem size in bytes.

used_bytesintegerRequired

Bytes in use.

available_bytesintegerRequired

Bytes still available.

used_percentnumberRequired

Percentage of the filesystem in use.

sampled_atstring (date-time)Required

When the sample was taken.

stalebooleanRequired

true when the sample is older than the agent's normal reporting interval.

created_atstring (date-time)Required

When the volume was created (RFC 3339).

attached_atstring (date-time)

When the volume was last attached. Omitted if it has never been attached. Kept after the volume is detached.

detached_atstring (date-time)

When the volume was last detached. Omitted if it has never been detached or was attached again since.

last_failurestring

Reason for the last failed operation on the volume. Omitted when there is none.

statusstringRequired

Status of the operation. queued for a new request. On a replay, the original operation's current status.

One ofqueuedrunningsucceededfailed

events_urlstringRequired

Path of the server-sent events stream with the operation's progress.

is_replaybooleanRequired

true when an existing operation was returned for a reused X-Idempotency key.

is_completedboolean

Present and true on a replay whose original operation has already finished.

Response

200

Replay. The X-Idempotency key was already used for this action, so the existing operation is returned and nothing is queued. status is the operation's status and volume is the volume as it is now (status: deleted once it is gone).

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

UID of the queued (or replayed) operation. Pass it to Get an operation.

volumeobjectRequired
Show attributes
uidstringRequired

Unique identifier of the volume.

namestringRequired

Display name of the volume.

slugstringRequired

URL-friendly form of the name. Not necessarily unique.

descriptionstring

Free-text description. Omitted when empty.

statusstringRequired

Lifecycle state. available volumes can be attached, in-use volumes are attached to the VM in vm_uid. failed means creating or deleting the volume failed. See last_failure. deleted only appears in an idempotent replay of a delete.

One ofcreatingavailableattachingin-usedetachingdeletingdeletedfailed

zone_slugstringRequired

Zone the volume lives in.

size_gibintegerRequired

Size of the volume in GiB.

filesystemstringRequired

Filesystem the volume is formatted with.

One ofext4xfs

formattedbooleanRequired

true once the volume has been formatted, which happens on its first successful attach.

vm_uidstring

UID of the VM the volume is attached to or being attached to. Omitted when detached.

vm_namestring

Name of that VM. Omitted when detached or when the VM cannot be found.

device_namestring

Block device inside the VM, as reported by the guest agent. Omitted until reported.

mount_pathstring

Where the volume is mounted inside the VM, under /mnt/rumpty/, as reported by the guest agent. Omitted until reported.

usageobject

Filesystem usage reported by the VM's guest agent. Omitted until the agent has reported a sample for the mounted volume. The last sample is kept after the volume is detached.

Show attributes
total_bytesintegerRequired

Filesystem size in bytes.

used_bytesintegerRequired

Bytes in use.

available_bytesintegerRequired

Bytes still available.

used_percentnumberRequired

Percentage of the filesystem in use.

sampled_atstring (date-time)Required

When the sample was taken.

stalebooleanRequired

true when the sample is older than the agent's normal reporting interval.

created_atstring (date-time)Required

When the volume was created (RFC 3339).

attached_atstring (date-time)

When the volume was last attached. Omitted if it has never been attached. Kept after the volume is detached.

detached_atstring (date-time)

When the volume was last detached. Omitted if it has never been detached or was attached again since.

last_failurestring

Reason for the last failed operation on the volume. Omitted when there is none.

statusstringRequired

Status of the operation. queued for a new request. On a replay, the original operation's current status.

One ofqueuedrunningsucceededfailed

events_urlstringRequired

Path of the server-sent events stream with the operation's progress.

is_replaybooleanRequired

true when an existing operation was returned for a reused X-Idempotency key.

is_completedboolean

Present and true on a replay whose original operation has already finished.

Errors

StatusMeaning
400Validation failed. Possible messages: invalid request (malformed JSON, or name or size_gib missing or 0), name is required (blank name), size_gib must be between 1 and 1024, or filesystem must be ext4 or xfs.
401The API key is missing, invalid, expired or revoked.
402The account is past due, so new paid resources cannot be created.
403You cannot access the workspace, your role does not allow this action, or the account is suspended.
409The X-Idempotency key was already used for a different operation in the workspace (action: idempotency_key_reused).

Errors use the standard error format.