show invoices
curl --request GET \
--url https://console.vast.ai/api/v0/users/{user_id}/invoices/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://console.vast.ai/api/v0/users/{user_id}/invoices/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://console.vast.ai/api/v0/users/{user_id}/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/users/{user_id}/invoices/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://console.vast.ai/api/v0/users/{user_id}/invoices/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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/users/{user_id}/invoices/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/users/{user_id}/invoices/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"invoices": [
{
"id": 123,
"type": "payment",
"service": "stripe",
"amount": 100,
"timestamp": 1672531199
}
],
"username": "user@example.com",
"bill_to": "John Doe\n123 Main St\nCity, ZIP\nCountry",
"email": "user@example.com",
"fullname": "John Doe",
"address1": "123 Main St",
"address2": "Apt 4B",
"city": "City",
"zip": "12345",
"country": "Country",
"taxinfo": "Tax Info",
"current": {
"charges": 150,
"service_fee": 15,
"total": 165,
"credit": 50
}
}{
"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=2.0"
}Billing
show invoices
This endpoint retrieves billing history reports for the authenticated user, including charges and credits.
CLI Usage: vastai show invoices
GET
/
api
/
v0
/
users
/
{user_id}
/
invoices
/
show invoices
curl --request GET \
--url https://console.vast.ai/api/v0/users/{user_id}/invoices/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://console.vast.ai/api/v0/users/{user_id}/invoices/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://console.vast.ai/api/v0/users/{user_id}/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/users/{user_id}/invoices/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://console.vast.ai/api/v0/users/{user_id}/invoices/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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/users/{user_id}/invoices/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/users/{user_id}/invoices/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"invoices": [
{
"id": 123,
"type": "payment",
"service": "stripe",
"amount": 100,
"timestamp": 1672531199
}
],
"username": "user@example.com",
"bill_to": "John Doe\n123 Main St\nCity, ZIP\nCountry",
"email": "user@example.com",
"fullname": "John Doe",
"address1": "123 Main St",
"address2": "Apt 4B",
"city": "City",
"zip": "12345",
"country": "Country",
"taxinfo": "Tax Info",
"current": {
"charges": 150,
"service_fee": 15,
"total": 165,
"credit": 50
}
}{
"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=2.0"
}Authorizations
API key must be provided in the Authorization header
Path Parameters
The ID of the user whose invoices are being retrieved.
Query Parameters
Include charge items in the report.
Show only payout items.
Exclude payout items.
Start date and time for the report.
End date and time for the report.
Response
Success response with billing history reports
Show child attributes
Show child attributes
Example:
"user@example.com"
Example:
"John Doe\n123 Main St\nCity, ZIP\nCountry"
Example:
"user@example.com"
Example:
"John Doe"
Example:
"123 Main St"
Example:
"Apt 4B"
Example:
"City"
Example:
"12345"
Example:
"Country"
Example:
"Tax Info"
Show child attributes
Show child attributes