list network-volume
curl --request POST \
--url https://console.vast.ai/api/v0/network_volume/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"disk_id": 123,
"price_disk": 123,
"size": 123,
"credit_discount_max": 123,
"end_date": 123
}
'import requests
url = "https://console.vast.ai/api/v0/network_volume/"
payload = {
"disk_id": 123,
"price_disk": 123,
"size": 123,
"credit_discount_max": 123,
"end_date": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
disk_id: 123,
price_disk: 123,
size: 123,
credit_discount_max: 123,
end_date: 123
})
};
fetch('https://console.vast.ai/api/v0/network_volume/', 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://console.vast.ai/api/v0/network_volume/",
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([
'disk_id' => 123,
'price_disk' => 123,
'size' => 123,
'credit_discount_max' => 123,
'end_date' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://console.vast.ai/api/v0/network_volume/"
payload := strings.NewReader("{\n \"disk_id\": 123,\n \"price_disk\": 123,\n \"size\": 123,\n \"credit_discount_max\": 123,\n \"end_date\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://console.vast.ai/api/v0/network_volume/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"disk_id\": 123,\n \"price_disk\": 123,\n \"size\": 123,\n \"credit_discount_max\": 123,\n \"end_date\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/network_volume/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"disk_id\": 123,\n \"price_disk\": 123,\n \"size\": 123,\n \"credit_discount_max\": 123,\n \"end_date\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"disk_id": "created network volume ask with id 6 and size 24"
}{
"error": "invalid_args",
"msg": "Invalid disk_id"
}{
"error": "not_authorized",
"msg": "Could not find network disk with id 6 associated with user"
}Network Volumes
list network-volume
Lists a network disk for rent as network volumes, or updates an existing listing with a new price/size/end date/discount.
CLI Usage: vastai list network-volume <disk_id> [options]
POST
/
api
/
v0
/
network_volume
/
list network-volume
curl --request POST \
--url https://console.vast.ai/api/v0/network_volume/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"disk_id": 123,
"price_disk": 123,
"size": 123,
"credit_discount_max": 123,
"end_date": 123
}
'import requests
url = "https://console.vast.ai/api/v0/network_volume/"
payload = {
"disk_id": 123,
"price_disk": 123,
"size": 123,
"credit_discount_max": 123,
"end_date": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
disk_id: 123,
price_disk: 123,
size: 123,
credit_discount_max: 123,
end_date: 123
})
};
fetch('https://console.vast.ai/api/v0/network_volume/', 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://console.vast.ai/api/v0/network_volume/",
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([
'disk_id' => 123,
'price_disk' => 123,
'size' => 123,
'credit_discount_max' => 123,
'end_date' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://console.vast.ai/api/v0/network_volume/"
payload := strings.NewReader("{\n \"disk_id\": 123,\n \"price_disk\": 123,\n \"size\": 123,\n \"credit_discount_max\": 123,\n \"end_date\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://console.vast.ai/api/v0/network_volume/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"disk_id\": 123,\n \"price_disk\": 123,\n \"size\": 123,\n \"credit_discount_max\": 123,\n \"end_date\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/network_volume/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"disk_id\": 123,\n \"price_disk\": 123,\n \"size\": 123,\n \"credit_discount_max\": 123,\n \"end_date\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"disk_id": "created network volume ask with id 6 and size 24"
}{
"error": "invalid_args",
"msg": "Invalid disk_id"
}{
"error": "not_authorized",
"msg": "Could not find network disk with id 6 associated with user"
}Authorizations
API key must be provided in the Authorization header
Body
application/json
ID of network disk for which offer is being created
Price per GB of network volume storage
Size in GB of the amount of space available to be rented
Maximum discount rate allowed for prepaid credits
Unix timestamp for when the listing expires
⌘I