Create a volume
{"volumeID", "name", "token", "sizeMB", "region", "state", "createdAt"}. sizeMB is in MiB and defaults
to 10,240 (10 GiB); the smallest volume is 1,024 and the largest 102,400. sizeBytes is accepted too. region is
optional and defaults as for a sandbox create. token is always empty; it is there because the E2B SDK types ask for it.
A name is 1 to 128 characters of letters, digits, ., _ and -, starts with a letter or a digit, and is unique in your
account: a name you already have answers 409 name_taken.
You pay for the size you ask for, not for what you write. A volume cannot be resized.
Mount it
nameis the volume’s name or itsvolumeID;pathis where the guest mounts it. A path is absolute and normalised, at most 255 bytes, not/and not under/proc,/sys,/dev,/run,/bootor/etc. A sandbox mounts at most 4 volumes, each once, each at its own path.readOnly: truemounts the volume read-only. It still takes the volume for this sandbox alone.- The sandbox is started on the machine that keeps the volume, so it waits for capacity on that machine only and answers
503 capacitywhen it has none. A volume in another region than the create names answers422 volume_region_mismatch; leaveregionout to start where the volume is. - The disk is mounted before the create answers its first call. The answer and
GET /sandboxes/{id}list the mounts asvolumeMounts. - One sandbox at a time holds a volume. A create that names a volume a running sandbox holds answers
409 volume_busyat once. A sandbox that is killed gives its volumes back before the kill answers, and a create that names the volume of a sandbox still stopping waits for it, so killing a sandbox and mounting its volume in a new one right away works.
autoPause and lifecycle.onTimeout: "pause" answer
422 together with volumeMounts. The volume stays; mount it in a new sandbox. Pausing, snapshotting, forking or
rewinding such a sandbox answers 409 volume_mounted.
Whatever a program wrote is on the volume once its fsync returned, and everything is flushed when the sandbox is killed
or ends at its timeout. If the machine itself fails, the volume is lost: a volume is kept on one machine and is not
backed up.
List, read and delete
GET /volumeslists your volumes, oldest first:[{"volumeID", "name", "sizeMB", "region", "state", "attachedTo"?}].stateisready,attachedorcreating.GET /volumes/{volume}reads one by name or id.DELETE /volumes/{volume}removes the data and the name (204). A volume a sandbox holds answers409 volume_busy(volume is attached to sandbox <id>); kill the sandbox first. The ComputeSDK and E2B SDKs retry that answer for you.
Limits
Volumes are listed with their price on billing.
E2B and ComputeSDK
The E2B shape works as is:Volume.create(name), Volume.list(), Volume.destroy(id) and volumeMounts on a create.
The ComputeSDK volume.create/get/list/delete calls and the volumes option of a create map onto the same routes.