Create Volume Listings
curl --request POST \
--url https://console.vast.ai/api/v0/volumes/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hidden_listing": false,
"machine": 7890,
"machines": [
7890,
7891
]
}
'import requests
url = "https://console.vast.ai/api/v0/volumes/"
payload = {
"hidden_listing": False,
"machine": 7890,
"machines": [7890, 7891]
}
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({hidden_listing: false, machine: 7890, machines: [7890, 7891]})
};
fetch('https://console.vast.ai/api/v0/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://console.vast.ai/api/v0/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([
'hidden_listing' => false,
'machine' => 7890,
'machines' => [
7890,
7891
]
]),
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/volumes/"
payload := strings.NewReader("{\n \"hidden_listing\": false,\n \"machine\": 7890,\n \"machines\": [\n 7890,\n 7891\n ]\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/volumes/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"hidden_listing\": false,\n \"machine\": 7890,\n \"machines\": [\n 7890,\n 7891\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/volumes/")
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 \"hidden_listing\": false,\n \"machine\": 7890,\n \"machines\": [\n 7890,\n 7891\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"you_sent": {},
"results": [
{
"machine_id": 123,
"user_id": 123,
"extended": 123,
"new_contracts": [
{
"id": 123,
"size": 123
}
],
"upd_contracts": [
123
]
}
]
}{
"error": "<string>",
"msg": "<string>"
}{
"error": "<string>",
"msg": "<string>"
}{
"error": "<string>",
"msg": "<string>"
}Volumes
Create Volume Listings
Creates or updates disk volume ask listings for one or more of the host’s machines.
POST
/
api
/
v0
/
volumes
/
Create Volume Listings
curl --request POST \
--url https://console.vast.ai/api/v0/volumes/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hidden_listing": false,
"machine": 7890,
"machines": [
7890,
7891
]
}
'import requests
url = "https://console.vast.ai/api/v0/volumes/"
payload = {
"hidden_listing": False,
"machine": 7890,
"machines": [7890, 7891]
}
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({hidden_listing: false, machine: 7890, machines: [7890, 7891]})
};
fetch('https://console.vast.ai/api/v0/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://console.vast.ai/api/v0/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([
'hidden_listing' => false,
'machine' => 7890,
'machines' => [
7890,
7891
]
]),
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/volumes/"
payload := strings.NewReader("{\n \"hidden_listing\": false,\n \"machine\": 7890,\n \"machines\": [\n 7890,\n 7891\n ]\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/volumes/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"hidden_listing\": false,\n \"machine\": 7890,\n \"machines\": [\n 7890,\n 7891\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/volumes/")
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 \"hidden_listing\": false,\n \"machine\": 7890,\n \"machines\": [\n 7890,\n 7891\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"you_sent": {},
"results": [
{
"machine_id": 123,
"user_id": 123,
"extended": 123,
"new_contracts": [
{
"id": 123,
"size": 123
}
],
"upd_contracts": [
123
]
}
]
}{
"error": "<string>",
"msg": "<string>"
}{
"error": "<string>",
"msg": "<string>"
}{
"error": "<string>",
"msg": "<string>"
}Authorizations
API key must be provided in the Authorization header
Body
application/json
When true, the volume listing is not shown in public marketplace search results.
Example:
false
Single machine ID to list a volume for. Use machines (array) for multiple. One of machine or machines is required.
Example:
7890
List of machine IDs to list volumes for simultaneously. Overrides machine if both are supplied.
Example:
[7890, 7891]
Response
Returns {"success": , "you_sent": <request_body>, "results": [{"machine_id", "user_id", "extended", "new_contracts", "upd_contracts"}, ...]}
⌘I