curl --request GET \
--url https://sailbox-api.sailresearch.com/v1/sailboxes/spend \
--header 'Authorization: Bearer <token>'import requests
url = "https://sailbox-api.sailresearch.com/v1/sailboxes/spend"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://sailbox-api.sailresearch.com/v1/sailboxes/spend', 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://sailbox-api.sailresearch.com/v1/sailboxes/spend",
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://sailbox-api.sailresearch.com/v1/sailboxes/spend"
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://sailbox-api.sailresearch.com/v1/sailboxes/spend")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sailbox-api.sailresearch.com/v1/sailboxes/spend")
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{
"start_at": "2023-11-07T05:31:56Z",
"end_at": "2023-11-07T05:31:56Z",
"finalized_cost_usd_nanos": 123,
"estimated_active_cost_usd_nanos": 123,
"estimated_total_cost_usd_nanos": 123,
"duration_seconds": 123,
"vcpu_seconds": 123,
"memory_gib_seconds": 123,
"state_disk_gib_seconds": 123,
"creation_fees_waived": true,
"rates": {
"vcpu_second_usd_nanos": 123,
"memory_gib_second_usd_nanos": 123,
"state_disk_gib_second_usd_nanos": 123,
"s_creation_usd_nanos": 123,
"m_creation_usd_nanos": 123,
"l_creation_usd_nanos": 123
},
"sailboxes": [
{
"sailbox_id": "<string>",
"app_id": "<string>",
"finalized_cost_usd_nanos": 123,
"estimated_active_cost_usd_nanos": 123,
"estimated_total_cost_usd_nanos": 123,
"duration_seconds": 123,
"vcpu_seconds": 123,
"memory_gib_seconds": 123,
"state_disk_gib_seconds": 123,
"active": true
}
]
}{
"error": {
"message": "memory_limit_gib for size m must be between 8 and 128",
"type": "invalid_request_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error",
"param": null,
"code": "invalid_api_key"
}
}{
"error": {
"message": "Your API key has been disabled due to insufficient credits. Visit https://app.sailresearch.com/billing to add credits.",
"type": "billing_error",
"param": null,
"code": "credits_exhausted",
"billing_url": "https://app.sailresearch.com/billing"
}
}{
"error": {
"message": "sailboxes require an organization-scoped API key",
"type": "permission_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Too many concurrent requests. Please retry after some of your organization's in-flight requests complete.",
"type": "rate_limit_error",
"param": null,
"code": "rate_limited"
}
}{
"error": {
"message": "failed to fetch sailbox",
"type": "server_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Authentication service unavailable",
"type": "server_error",
"param": null,
"code": null
}
}Get Sailbox spend
Returns Sailbox usage and estimated cost for your organization over a time window, with a per-Sailbox breakdown. Defaults to the current UTC calendar month up to now. Costs are reported in billionths of a US dollar, and the active portion is an estimate that settles when the Sailbox stops.
curl --request GET \
--url https://sailbox-api.sailresearch.com/v1/sailboxes/spend \
--header 'Authorization: Bearer <token>'import requests
url = "https://sailbox-api.sailresearch.com/v1/sailboxes/spend"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://sailbox-api.sailresearch.com/v1/sailboxes/spend', 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://sailbox-api.sailresearch.com/v1/sailboxes/spend",
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://sailbox-api.sailresearch.com/v1/sailboxes/spend"
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://sailbox-api.sailresearch.com/v1/sailboxes/spend")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sailbox-api.sailresearch.com/v1/sailboxes/spend")
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{
"start_at": "2023-11-07T05:31:56Z",
"end_at": "2023-11-07T05:31:56Z",
"finalized_cost_usd_nanos": 123,
"estimated_active_cost_usd_nanos": 123,
"estimated_total_cost_usd_nanos": 123,
"duration_seconds": 123,
"vcpu_seconds": 123,
"memory_gib_seconds": 123,
"state_disk_gib_seconds": 123,
"creation_fees_waived": true,
"rates": {
"vcpu_second_usd_nanos": 123,
"memory_gib_second_usd_nanos": 123,
"state_disk_gib_second_usd_nanos": 123,
"s_creation_usd_nanos": 123,
"m_creation_usd_nanos": 123,
"l_creation_usd_nanos": 123
},
"sailboxes": [
{
"sailbox_id": "<string>",
"app_id": "<string>",
"finalized_cost_usd_nanos": 123,
"estimated_active_cost_usd_nanos": 123,
"estimated_total_cost_usd_nanos": 123,
"duration_seconds": 123,
"vcpu_seconds": 123,
"memory_gib_seconds": 123,
"state_disk_gib_seconds": 123,
"active": true
}
]
}{
"error": {
"message": "memory_limit_gib for size m must be between 8 and 128",
"type": "invalid_request_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error",
"param": null,
"code": "invalid_api_key"
}
}{
"error": {
"message": "Your API key has been disabled due to insufficient credits. Visit https://app.sailresearch.com/billing to add credits.",
"type": "billing_error",
"param": null,
"code": "credits_exhausted",
"billing_url": "https://app.sailresearch.com/billing"
}
}{
"error": {
"message": "sailboxes require an organization-scoped API key",
"type": "permission_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Too many concurrent requests. Please retry after some of your organization's in-flight requests complete.",
"type": "rate_limit_error",
"param": null,
"code": "rate_limited"
}
}{
"error": {
"message": "failed to fetch sailbox",
"type": "server_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Authentication service unavailable",
"type": "server_error",
"param": null,
"code": null
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Start of the window, as an RFC 3339 timestamp. Defaults to the first of the current UTC month.
End of the window, as an RFC 3339 timestamp. Defaults to now, and must be after from.
Only count Sailboxes in this app.
Only count this Sailbox.
Response
The spend summary.
Start of the window.
End of the window.
Cost of time already used, in billionths of a US dollar.
Estimated cost of time still in progress.
Finalized plus estimated active cost.
Total Sailbox seconds in the window.
Total virtual CPU seconds used.
Total memory GiB seconds used.
Total disk GiB seconds used.
Whether creation fees are waived for your organization. When true the totals include no creation charges, though rates still lists the creation price.
Prices used to work out the costs in this response, in billionths of a US dollar. New rates can appear over time.
Show child attributes
Show child attributes
Per-Sailbox breakdown.
Show child attributes
Show child attributes