search invoices
curl --request GET \
--url https://console.vast.ai/api/v0/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "charge",
"select_filters": {}
}
'import requests
url = "https://console.vast.ai/api/v0/invoices"
payload = {
"type": "charge",
"select_filters": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({type: 'charge', select_filters: {}})
};
fetch('https://console.vast.ai/api/v0/invoices', 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/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'charge',
'select_filters' => [
]
]),
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/invoices"
payload := strings.NewReader("{\n \"type\": \"charge\",\n \"select_filters\": {}\n}")
req, _ := http.NewRequest("GET", 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.get("https://console.vast.ai/api/v0/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"charge\",\n \"select_filters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"charge\",\n \"select_filters\": {}\n}"
response = http.request(request)
puts response.read_body[
{
"type": "charge",
"description": "Instance 123 GPU charge: hours * $/hr",
"timestamp": 1633036800,
"quantity": "10.000",
"rate": "0.1000",
"amount": "1.000",
"instance_id": 123
}
]{
"success": false,
"error": "<string>",
"msg": "<string>"
}{
"success": false,
"error": "<string>",
"msg": "<string>"
}{
"success": false,
"error": "<string>",
"msg": "<string>"
}{
"detail": "API requests too frequent endpoint threshold=3.0"
}Billing
search invoices
This endpoint allows users to search and retrieve invoices based on specified filters.
CLI Usage: vastai search invoices
GET
/
api
/
v0
/
invoices
search invoices
curl --request GET \
--url https://console.vast.ai/api/v0/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "charge",
"select_filters": {}
}
'import requests
url = "https://console.vast.ai/api/v0/invoices"
payload = {
"type": "charge",
"select_filters": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({type: 'charge', select_filters: {}})
};
fetch('https://console.vast.ai/api/v0/invoices', 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/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'charge',
'select_filters' => [
]
]),
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/invoices"
payload := strings.NewReader("{\n \"type\": \"charge\",\n \"select_filters\": {}\n}")
req, _ := http.NewRequest("GET", 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.get("https://console.vast.ai/api/v0/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"charge\",\n \"select_filters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"charge\",\n \"select_filters\": {}\n}"
response = http.request(request)
puts response.read_body[
{
"type": "charge",
"description": "Instance 123 GPU charge: hours * $/hr",
"timestamp": 1633036800,
"quantity": "10.000",
"rate": "0.1000",
"amount": "1.000",
"instance_id": 123
}
]{
"success": false,
"error": "<string>",
"msg": "<string>"
}{
"success": false,
"error": "<string>",
"msg": "<string>"
}{
"success": false,
"error": "<string>",
"msg": "<string>"
}{
"detail": "API requests too frequent endpoint threshold=3.0"
}Authorizations
API key must be provided in the Authorization header
Body
application/json
⌘I