Volumes
Create Volume
Create a volume for a specific app using the details provided in the request body.
POST
/
v1
/
apps
/
{app_name}
/
volumes
Create Volume
curl --request POST \
--url https://api.machines.dev/v1/apps/{app_name}/volumes \
--header 'Content-Type: application/json' \
--data '
{
"auto_backup_enabled": true,
"compute": {
"cpu_kind": "<string>",
"cpus": 123,
"gpu_kind": "<string>",
"gpus": 123,
"host_dedication_id": "<string>",
"kernel_args": [
"<string>"
],
"max_memory_mb": 123,
"memory_mb": 123,
"required_host_features": [
"<string>"
]
},
"compute_image": "<string>",
"encrypted": true,
"fstype": "<string>",
"name": "<string>",
"region": "<string>",
"require_unique_zone": true,
"size_gb": 123,
"snapshot_id": "<string>",
"snapshot_retention": 123,
"source_volume_id": "<string>",
"unique_zone_app_wide": true
}
'import requests
url = "https://api.machines.dev/v1/apps/{app_name}/volumes"
payload = {
"auto_backup_enabled": True,
"compute": {
"cpu_kind": "<string>",
"cpus": 123,
"gpu_kind": "<string>",
"gpus": 123,
"host_dedication_id": "<string>",
"kernel_args": ["<string>"],
"max_memory_mb": 123,
"memory_mb": 123,
"required_host_features": ["<string>"]
},
"compute_image": "<string>",
"encrypted": True,
"fstype": "<string>",
"name": "<string>",
"region": "<string>",
"require_unique_zone": True,
"size_gb": 123,
"snapshot_id": "<string>",
"snapshot_retention": 123,
"source_volume_id": "<string>",
"unique_zone_app_wide": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
auto_backup_enabled: true,
compute: {
cpu_kind: '<string>',
cpus: 123,
gpu_kind: '<string>',
gpus: 123,
host_dedication_id: '<string>',
kernel_args: ['<string>'],
max_memory_mb: 123,
memory_mb: 123,
required_host_features: ['<string>']
},
compute_image: '<string>',
encrypted: true,
fstype: '<string>',
name: '<string>',
region: '<string>',
require_unique_zone: true,
size_gb: 123,
snapshot_id: '<string>',
snapshot_retention: 123,
source_volume_id: '<string>',
unique_zone_app_wide: true
})
};
fetch('https://api.machines.dev/v1/apps/{app_name}/volumes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.machines.dev/v1/apps/{app_name}/volumes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'auto_backup_enabled' => true,
'compute' => [
'cpu_kind' => '<string>',
'cpus' => 123,
'gpu_kind' => '<string>',
'gpus' => 123,
'host_dedication_id' => '<string>',
'kernel_args' => [
'<string>'
],
'max_memory_mb' => 123,
'memory_mb' => 123,
'required_host_features' => [
'<string>'
]
],
'compute_image' => '<string>',
'encrypted' => true,
'fstype' => '<string>',
'name' => '<string>',
'region' => '<string>',
'require_unique_zone' => true,
'size_gb' => 123,
'snapshot_id' => '<string>',
'snapshot_retention' => 123,
'source_volume_id' => '<string>',
'unique_zone_app_wide' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.machines.dev/v1/apps/{app_name}/volumes"
payload := strings.NewReader("{\n \"auto_backup_enabled\": true,\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"compute_image\": \"<string>\",\n \"encrypted\": true,\n \"fstype\": \"<string>\",\n \"name\": \"<string>\",\n \"region\": \"<string>\",\n \"require_unique_zone\": true,\n \"size_gb\": 123,\n \"snapshot_id\": \"<string>\",\n \"snapshot_retention\": 123,\n \"source_volume_id\": \"<string>\",\n \"unique_zone_app_wide\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.machines.dev/v1/apps/{app_name}/volumes")
.header("Content-Type", "application/json")
.body("{\n \"auto_backup_enabled\": true,\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"compute_image\": \"<string>\",\n \"encrypted\": true,\n \"fstype\": \"<string>\",\n \"name\": \"<string>\",\n \"region\": \"<string>\",\n \"require_unique_zone\": true,\n \"size_gb\": 123,\n \"snapshot_id\": \"<string>\",\n \"snapshot_retention\": 123,\n \"source_volume_id\": \"<string>\",\n \"unique_zone_app_wide\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.machines.dev/v1/apps/{app_name}/volumes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"auto_backup_enabled\": true,\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"compute_image\": \"<string>\",\n \"encrypted\": true,\n \"fstype\": \"<string>\",\n \"name\": \"<string>\",\n \"region\": \"<string>\",\n \"require_unique_zone\": true,\n \"size_gb\": 123,\n \"snapshot_id\": \"<string>\",\n \"snapshot_retention\": 123,\n \"source_volume_id\": \"<string>\",\n \"unique_zone_app_wide\": true\n}"
response = http.request(request)
puts response.read_body{
"attached_alloc_id": "<string>",
"attached_machine_id": "<string>",
"auto_backup_enabled": true,
"block_size": 123,
"blocks": 123,
"blocks_avail": 123,
"blocks_free": 123,
"bytes_total": 123,
"bytes_used": 123,
"created_at": "<string>",
"encrypted": true,
"fstype": "<string>",
"host_features": [
"<string>"
],
"host_status": "ok",
"id": "<string>",
"name": "<string>",
"region": "<string>",
"required_host_features": [
"<string>"
],
"size_gb": 123,
"snapshot_retention": 123,
"state": "<string>",
"type": "local",
"zone": "<string>"
}Path Parameters
Fly App Name
Body
application/json
Request body
enable scheduled automatic snapshots. Defaults to true
Show child attributes
Show child attributes
restore from snapshot
fork from remote volume
Response
200 - application/json
OK
Available options:
ok, unknown, unreachable Available options:
local, cache ⌘I
Create Volume
curl --request POST \
--url https://api.machines.dev/v1/apps/{app_name}/volumes \
--header 'Content-Type: application/json' \
--data '
{
"auto_backup_enabled": true,
"compute": {
"cpu_kind": "<string>",
"cpus": 123,
"gpu_kind": "<string>",
"gpus": 123,
"host_dedication_id": "<string>",
"kernel_args": [
"<string>"
],
"max_memory_mb": 123,
"memory_mb": 123,
"required_host_features": [
"<string>"
]
},
"compute_image": "<string>",
"encrypted": true,
"fstype": "<string>",
"name": "<string>",
"region": "<string>",
"require_unique_zone": true,
"size_gb": 123,
"snapshot_id": "<string>",
"snapshot_retention": 123,
"source_volume_id": "<string>",
"unique_zone_app_wide": true
}
'import requests
url = "https://api.machines.dev/v1/apps/{app_name}/volumes"
payload = {
"auto_backup_enabled": True,
"compute": {
"cpu_kind": "<string>",
"cpus": 123,
"gpu_kind": "<string>",
"gpus": 123,
"host_dedication_id": "<string>",
"kernel_args": ["<string>"],
"max_memory_mb": 123,
"memory_mb": 123,
"required_host_features": ["<string>"]
},
"compute_image": "<string>",
"encrypted": True,
"fstype": "<string>",
"name": "<string>",
"region": "<string>",
"require_unique_zone": True,
"size_gb": 123,
"snapshot_id": "<string>",
"snapshot_retention": 123,
"source_volume_id": "<string>",
"unique_zone_app_wide": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
auto_backup_enabled: true,
compute: {
cpu_kind: '<string>',
cpus: 123,
gpu_kind: '<string>',
gpus: 123,
host_dedication_id: '<string>',
kernel_args: ['<string>'],
max_memory_mb: 123,
memory_mb: 123,
required_host_features: ['<string>']
},
compute_image: '<string>',
encrypted: true,
fstype: '<string>',
name: '<string>',
region: '<string>',
require_unique_zone: true,
size_gb: 123,
snapshot_id: '<string>',
snapshot_retention: 123,
source_volume_id: '<string>',
unique_zone_app_wide: true
})
};
fetch('https://api.machines.dev/v1/apps/{app_name}/volumes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.machines.dev/v1/apps/{app_name}/volumes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'auto_backup_enabled' => true,
'compute' => [
'cpu_kind' => '<string>',
'cpus' => 123,
'gpu_kind' => '<string>',
'gpus' => 123,
'host_dedication_id' => '<string>',
'kernel_args' => [
'<string>'
],
'max_memory_mb' => 123,
'memory_mb' => 123,
'required_host_features' => [
'<string>'
]
],
'compute_image' => '<string>',
'encrypted' => true,
'fstype' => '<string>',
'name' => '<string>',
'region' => '<string>',
'require_unique_zone' => true,
'size_gb' => 123,
'snapshot_id' => '<string>',
'snapshot_retention' => 123,
'source_volume_id' => '<string>',
'unique_zone_app_wide' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.machines.dev/v1/apps/{app_name}/volumes"
payload := strings.NewReader("{\n \"auto_backup_enabled\": true,\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"compute_image\": \"<string>\",\n \"encrypted\": true,\n \"fstype\": \"<string>\",\n \"name\": \"<string>\",\n \"region\": \"<string>\",\n \"require_unique_zone\": true,\n \"size_gb\": 123,\n \"snapshot_id\": \"<string>\",\n \"snapshot_retention\": 123,\n \"source_volume_id\": \"<string>\",\n \"unique_zone_app_wide\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.machines.dev/v1/apps/{app_name}/volumes")
.header("Content-Type", "application/json")
.body("{\n \"auto_backup_enabled\": true,\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"compute_image\": \"<string>\",\n \"encrypted\": true,\n \"fstype\": \"<string>\",\n \"name\": \"<string>\",\n \"region\": \"<string>\",\n \"require_unique_zone\": true,\n \"size_gb\": 123,\n \"snapshot_id\": \"<string>\",\n \"snapshot_retention\": 123,\n \"source_volume_id\": \"<string>\",\n \"unique_zone_app_wide\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.machines.dev/v1/apps/{app_name}/volumes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"auto_backup_enabled\": true,\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"compute_image\": \"<string>\",\n \"encrypted\": true,\n \"fstype\": \"<string>\",\n \"name\": \"<string>\",\n \"region\": \"<string>\",\n \"require_unique_zone\": true,\n \"size_gb\": 123,\n \"snapshot_id\": \"<string>\",\n \"snapshot_retention\": 123,\n \"source_volume_id\": \"<string>\",\n \"unique_zone_app_wide\": true\n}"
response = http.request(request)
puts response.read_body{
"attached_alloc_id": "<string>",
"attached_machine_id": "<string>",
"auto_backup_enabled": true,
"block_size": 123,
"blocks": 123,
"blocks_avail": 123,
"blocks_free": 123,
"bytes_total": 123,
"bytes_used": 123,
"created_at": "<string>",
"encrypted": true,
"fstype": "<string>",
"host_features": [
"<string>"
],
"host_status": "ok",
"id": "<string>",
"name": "<string>",
"region": "<string>",
"required_host_features": [
"<string>"
],
"size_gb": 123,
"snapshot_retention": 123,
"state": "<string>",
"type": "local",
"zone": "<string>"
}