curl --request POST \
--url https://console.vast.ai/api/v0/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"webhook_url": "https://example.com/vastai-hook",
"event_types": [
"low_disk_space",
"near_end_date"
],
"name": "My integration"
}
'import requests
url = "https://console.vast.ai/api/v0/webhooks"
payload = {
"webhook_url": "https://example.com/vastai-hook",
"event_types": ["low_disk_space", "near_end_date"],
"name": "My integration"
}
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({
webhook_url: 'https://example.com/vastai-hook',
event_types: ['low_disk_space', 'near_end_date'],
name: 'My integration'
})
};
fetch('https://console.vast.ai/api/v0/webhooks', 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/webhooks",
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([
'webhook_url' => 'https://example.com/vastai-hook',
'event_types' => [
'low_disk_space',
'near_end_date'
],
'name' => 'My integration'
]),
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/webhooks"
payload := strings.NewReader("{\n \"webhook_url\": \"https://example.com/vastai-hook\",\n \"event_types\": [\n \"low_disk_space\",\n \"near_end_date\"\n ],\n \"name\": \"My integration\"\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/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"webhook_url\": \"https://example.com/vastai-hook\",\n \"event_types\": [\n \"low_disk_space\",\n \"near_end_date\"\n ],\n \"name\": \"My integration\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/webhooks")
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 \"webhook_url\": \"https://example.com/vastai-hook\",\n \"event_types\": [\n \"low_disk_space\",\n \"near_end_date\"\n ],\n \"name\": \"My integration\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"webhook": {
"id": 42,
"user_id": 1001,
"name": "My Webhook",
"webhook_url": "https://example.com/vastai-events",
"event_types": [
"low_disk_space"
],
"created_at": 1700000000,
"updated_at": 1700000000,
"webhook_secret": "abc123secretkey"
},
"enabled_notification_preferences": [
"host:low_disk_space"
]
}{
"error": "<string>",
"msg": "<string>"
}Create User Webhook
Register a new webhook URL for the authenticated user, subscribing it to the specified event types.
curl --request POST \
--url https://console.vast.ai/api/v0/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"webhook_url": "https://example.com/vastai-hook",
"event_types": [
"low_disk_space",
"near_end_date"
],
"name": "My integration"
}
'import requests
url = "https://console.vast.ai/api/v0/webhooks"
payload = {
"webhook_url": "https://example.com/vastai-hook",
"event_types": ["low_disk_space", "near_end_date"],
"name": "My integration"
}
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({
webhook_url: 'https://example.com/vastai-hook',
event_types: ['low_disk_space', 'near_end_date'],
name: 'My integration'
})
};
fetch('https://console.vast.ai/api/v0/webhooks', 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/webhooks",
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([
'webhook_url' => 'https://example.com/vastai-hook',
'event_types' => [
'low_disk_space',
'near_end_date'
],
'name' => 'My integration'
]),
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/webhooks"
payload := strings.NewReader("{\n \"webhook_url\": \"https://example.com/vastai-hook\",\n \"event_types\": [\n \"low_disk_space\",\n \"near_end_date\"\n ],\n \"name\": \"My integration\"\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/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"webhook_url\": \"https://example.com/vastai-hook\",\n \"event_types\": [\n \"low_disk_space\",\n \"near_end_date\"\n ],\n \"name\": \"My integration\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/webhooks")
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 \"webhook_url\": \"https://example.com/vastai-hook\",\n \"event_types\": [\n \"low_disk_space\",\n \"near_end_date\"\n ],\n \"name\": \"My integration\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"webhook": {
"id": 42,
"user_id": 1001,
"name": "My Webhook",
"webhook_url": "https://example.com/vastai-events",
"event_types": [
"low_disk_space"
],
"created_at": 1700000000,
"updated_at": 1700000000,
"webhook_secret": "abc123secretkey"
},
"enabled_notification_preferences": [
"host:low_disk_space"
]
}{
"error": "<string>",
"msg": "<string>"
}Authorizations
API key must be provided in the Authorization header
Body
HTTPS URL to receive webhook event deliveries; must start with 'https://', have a valid hostname, and be at most 2048 characters.
"https://example.com/vastai-hook"
List of notification slug strings (e.g. 'low_disk_space' or 'host:low_disk_space') this webhook should receive; must be non-empty and contain only known slugs.
["low_disk_space", "near_end_date"]
Optional human-readable display label for this webhook (max 120 characters, no control characters).
"My integration"
Response
Success; returns {success: true, webhook: object, enabled_notification_preferences: list}; webhook includes webhook_secret (shown once)
Always true on success.
The created webhook object including id, user_id, name, webhook_url, event_types, created_at, updated_at, and the one-time webhook_secret.
Show child attributes
Show child attributes
List of preference keys (e.g. 'host:low_disk_space') that were automatically enabled for webhook delivery.