Read cached sandbox resource measurements
Returns raw CPU, memory, and guest root filesystem measurements for a
sandbox the caller may read. This authenticated JSON endpoint is separate
from the operational Prometheus /metrics endpoint.
Poll every 15–30 seconds and honor the existing API rate limits. Polling
does not collect a new sample. Each resource has its own observation time;
values may be stale or absent, including with older guest versions.
Missing usage is null, never a fabricated zero. No utilization
percentages are calculated.
source: live means an observation came from the accepted current
runtime’s cache, not that it was freshly collected. source: last_known
identifies a retained observation. Paused, failed, and other inactive
states use only retained measurements without a live resource request.
Measurements and persistence never delay sandbox lifecycle operations.
Configured allocations and limits are current control-plane facts and
are separate from observations. A resize does not recompute or retimestamp
earlier usage. Effective CPU and memory allocations are returned only
when confirmed for the live runtime; otherwise they are null.
curl --request GET \
--url https://api.superserve.ai/sandboxes/{sandbox_id}/metrics \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.superserve.ai/sandboxes/{sandbox_id}/metrics"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.superserve.ai/sandboxes/{sandbox_id}/metrics', 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://api.superserve.ai/sandboxes/{sandbox_id}/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$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://api.superserve.ai/sandboxes/{sandbox_id}/metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.superserve.ai/sandboxes/{sandbox_id}/metrics")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.superserve.ai/sandboxes/{sandbox_id}/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "starting",
"cpu": {
"configured_vcpus": 123,
"effective_vcpus": 123,
"limit_vcpus": 123,
"usage": {
"used_vcpus": 1,
"sampled_at": "2023-11-07T05:31:56Z",
"window_seconds": 123,
"source": "live"
}
},
"memory": {
"configured_bytes": 123,
"effective_bytes": 123,
"limit_bytes": 123,
"usage": {
"used_bytes": 1,
"sampled_at": "2023-11-07T05:31:56Z",
"source": "live"
}
},
"disk": {
"configured_bytes": 123,
"effective_bytes": 123,
"limit_bytes": 123,
"usage": {
"total_bytes": 1,
"used_bytes": 1,
"available_bytes": 1,
"sampled_at": "2023-11-07T05:31:56Z",
"source": "live"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"action_url": "https://console.superserve.ai/plan-usage"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"action_url": "https://console.superserve.ai/plan-usage"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"action_url": "https://console.superserve.ai/plan-usage"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"action_url": "https://console.superserve.ai/plan-usage"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"action_url": "https://console.superserve.ai/plan-usage"
}
}Path Parameters
The unique identifier of the sandbox.
Public sandbox ID: a bare UUID, or the region-tagged form sb-<region>-<uuid> (e.g. sb-use-1b4e28ba-…). Treat as an opaque string; the tagged form routes the request to the sandbox's home region. Endpoints accept both forms interchangeably.
^(sb-[a-z0-9]+-)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$Response
Current allocations and independently timestamped observations
Public sandbox ID: a bare UUID, or the region-tagged form sb-<region>-<uuid> (e.g. sb-use-1b4e28ba-…). Treat as an opaque string; the tagged form routes the request to the sandbox's home region. Endpoints accept both forms interchangeably.
^(sb-[a-z0-9]+-)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$curl --request GET \
--url https://api.superserve.ai/sandboxes/{sandbox_id}/metrics \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.superserve.ai/sandboxes/{sandbox_id}/metrics"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.superserve.ai/sandboxes/{sandbox_id}/metrics', 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://api.superserve.ai/sandboxes/{sandbox_id}/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$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://api.superserve.ai/sandboxes/{sandbox_id}/metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.superserve.ai/sandboxes/{sandbox_id}/metrics")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.superserve.ai/sandboxes/{sandbox_id}/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "starting",
"cpu": {
"configured_vcpus": 123,
"effective_vcpus": 123,
"limit_vcpus": 123,
"usage": {
"used_vcpus": 1,
"sampled_at": "2023-11-07T05:31:56Z",
"window_seconds": 123,
"source": "live"
}
},
"memory": {
"configured_bytes": 123,
"effective_bytes": 123,
"limit_bytes": 123,
"usage": {
"used_bytes": 1,
"sampled_at": "2023-11-07T05:31:56Z",
"source": "live"
}
},
"disk": {
"configured_bytes": 123,
"effective_bytes": 123,
"limit_bytes": 123,
"usage": {
"total_bytes": 1,
"used_bytes": 1,
"available_bytes": 1,
"sampled_at": "2023-11-07T05:31:56Z",
"source": "live"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"action_url": "https://console.superserve.ai/plan-usage"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"action_url": "https://console.superserve.ai/plan-usage"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"action_url": "https://console.superserve.ai/plan-usage"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"action_url": "https://console.superserve.ai/plan-usage"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"action_url": "https://console.superserve.ai/plan-usage"
}
}