API reference · Volumes
Create a network volume (billed per GB-second until deleted)
/v1/volumes- TypeScript
client.volumes.create()- Python
client.volumes.create()- CLI
hayonix volumes create
Creates an empty network volume in a region, with a name unique in the project. It is not on any host until a pod first mounts it; from then on it is pinned to that host. Storage is billed from now until it is deleted, attached or not.
Project API key (Authorization: Bearer sk_…), or a console session. Requires the volume:create permission (a key's scope, or a role that includes it).
Examples
The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.
curl -sS "$API_BASE_URL/volumes" \
-H "Authorization: Bearer $API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"name": "datasets",
"size_gb": 50,
"region": "dev-local-1"
}'Request
| Header | Required | Description |
|---|---|---|
Authorization | yes | Bearer and your API key. The key implies its project. |
X-Project-Id | session only | The project to act in, for console sessions. Requests with an API key leave it out. |
Idempotency-Key | no | Makes a retry safe: the same key and request within 24 hours return the original response (see Idempotency). The SDKs send one for you. |
Body
JSON (application/json): CreateVolumeRequest.
namestringrequiredIts name
pattern ^[a-z0-9][a-z0-9._-]{0,62}$
size_gbintegerrequiredSize in GB
1–4096
regionstringrequiredRegion code
1–64 characters
Response
201 Volume — The new volume
objectstringrequiredAlways `volume`: the type of this object
One of
volumeidstringrequiredUnique ID (`vol_…`)
ID with prefix vol_
org_idstringrequiredOrganization it belongs to
ID with prefix org_
project_idstringrequiredProject it belongs to
ID with prefix prj_
namestringrequiredIts name
kindstringrequired`pod`: one pod’s own volume (exclusive). `network`: standalone, mountable by several pods at once. `cluster`: a cluster’s shared volume (deleted with the cluster).
One of
podnetworkclustersize_gbintegerrequiredSize in GB; storage is billed on this size
regionstringrequiredRegion code
statusstringrequired`creating`: being set up. `ready`: usable. `deleting`: deleted and billing stopped; its host is removing the data. `deleted`: the data is gone.
One of
creatingreadydeletingdeletedpinned_to_hostbooleanrequiredVolumes live on one host until shared storage exists. Once a pod has mounted it, the volume is pinned to that host, and every pod that mounts it (now or later) runs on that host — waiting for capacity there if it is full.
owner_pod_idstring | nullrequiredID of the owner pod
usageobject | nullrequiredSpace used against the size, as last measured by the host it lives on (while a pod or worker mounts it); null until then
ShowHide 3 fields of
usageused_bytesintegerrequiredSpace used on its host
size_bytesintegerrequiredThe size, enforced on the host: writes beyond it fail
observed_atstring (date-time)requiredWhen it was measured
attachmentsarray of objectrequiredPods whose configuration mounts the volume
ShowHide 3 fields of
attachmentspod_idstringrequiredID of the pod
mount_pathstringrequiredAbsolute path the volume is mounted at inside the container
read_onlybooleanrequiredMounted read-only in that pod
endpoint_attachmentsarray of objectrequiredServerless endpoints whose current release mounts the volume, or that still have a worker mounting it. While any is listed the volume cannot be deleted.
ShowHide 3 fields of
endpoint_attachmentsendpoint_idstringrequiredThe serverless endpoint
mount_pathstringrequiredWhere its workers see the volume
read_onlybooleanrequiredMounted read-only in its workers
billingobjectrequiredHow the volume’s storage is charged
ShowHide 3 fields of
billingmeterstringrequiredUnit of use: GB of size per second, from creation to deletion
One of
storage_gb_secondprice_keystringrequiredPrice list entry the storage is charged at: `pod_volume` or `network_volume`
billed_untilstring (date-time) | nullrequiredStorage is billed from creation to deletion, attached or not
created_atstring (date-time)requiredWhen it was created (ISO 8601, UTC)
updated_atstring (date-time)requiredWhen it last changed (ISO 8601, UTC)
deleted_atstring (date-time) | nullrequiredWhen it was deleted (null while it exists) (ISO 8601, UTC)
Example response
{
"object": "volume",
"id": "vol_01jc5zq4m8k3v6x9t2w7r0b1e4",
"org_id": "org_01jc5zq4m8k3v6x9t2w7r0b1e4",
"project_id": "prj_01jc5zq4m8k3v6x9t2w7r0b1e4",
"name": "string",
"kind": "pod",
"size_gb": 1,
"region": "string",
"status": "creating",
"pinned_to_host": true,
"owner_pod_id": "string",
"usage": {
"used_bytes": 1,
"size_bytes": 1,
"observed_at": "2026-01-01T00:00:00.000Z"
},
"attachments": [
{
"pod_id": "string",
"mount_path": "string",
"read_only": true
}
],
"endpoint_attachments": [
{
"endpoint_id": "string",
"mount_path": "string",
"read_only": true
}
],
"billing": {
"meter": "storage_gb_second",
"price_key": "string",
"billed_until": "2026-01-01T00:00:00.000Z"
},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z",
"deleted_at": "2026-01-01T00:00:00.000Z"
}Errors
Errors use the standard envelope. What this operation can answer:
| Status | Type | When |
|---|---|---|
400 | invalid_request_error | A parameter or body field is missing or not allowed; param names it. |
401 | authentication_error | The key or session is missing, revoked or expired. |
403 | permission_error | The credential lacks the permission this needs, or the organization is suspended. |
409 | conflict_error idempotency_in_progress | A request with the same Idempotency-Key is still running. |
422 | idempotency_error idempotency_key_reused | The Idempotency-Key was used with a different request. |
429 | rate_limit_error rate_limited | Too many requests; retry after retry-after seconds. |