curl --request GET \
--url {schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service} \
--header 'Authorization: Bearer <token>'import requests
url = "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}', 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 => "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}",
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 := "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}"
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("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"_grain": 5,
"_from": 1704067200,
"_to": 1704153600,
"_project_id": "abc123def456",
"_environment_id": "main",
"_branch_machine_name": "main-bvxea6i",
"_service": "admin-pipeline--kafka-profile-payloads",
"data": [
{
"timestamp": 1764083040,
"instances": {}
}
],
"_dg2_host_types_mapping": {
"app.0": "web",
"app.1": "unified",
"worker.0": ""
}
}{
"type": "https://tools.ietf.org/html/rfc2616#section-1",
"title": "Please ensure parameters are correct.",
"status": 400,
"violations": {
"grain": [
"Grain can not be larger than the selection windows."
],
"from": [
"The from timestamp must be in the past."
],
"to": [
"The to timestamp must be greater than the from timestamp."
]
}
}{
"error": "Too much data fetched",
"message": "Please reduce the time range or add more filters to narrow down the query"
}Get resource metrics by service
Returns time-series resource data for one service. Each timestamp contains per-instance metrics. Filter results using aggs[] (min, max, avg, stddev, p50, p95-p99) and types[] (cpu, memory, swap, disk, inodes, pressure metrics). Response grouped by timestamp then instance ID (e.g., “app.0”). All aggregations nullable when insufficient data exists.
curl --request GET \
--url {schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service} \
--header 'Authorization: Bearer <token>'import requests
url = "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}', 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 => "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}",
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 := "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}"
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("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}/observability/resources/service/{service}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"_grain": 5,
"_from": 1704067200,
"_to": 1704153600,
"_project_id": "abc123def456",
"_environment_id": "main",
"_branch_machine_name": "main-bvxea6i",
"_service": "admin-pipeline--kafka-profile-payloads",
"data": [
{
"timestamp": 1764083040,
"instances": {}
}
],
"_dg2_host_types_mapping": {
"app.0": "web",
"app.1": "unified",
"worker.0": ""
}
}{
"type": "https://tools.ietf.org/html/rfc2616#section-1",
"title": "Please ensure parameters are correct.",
"status": 400,
"violations": {
"grain": [
"Grain can not be larger than the selection windows."
],
"from": [
"The from timestamp must be in the past."
],
"to": [
"The to timestamp must be greater than the from timestamp."
]
}
}{
"error": "Too much data fetched",
"message": "Please reduce the time range or add more filters to narrow down the query"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The unique identifier of the Upsun project
[a-z0-9]+"abc123def456"
The environment identifier
.+"main"
The service name to retrieve metrics for (e.g., "app", "database", "admin-pipeline--kafka-profile-payloads")
"app"
Query Parameters
Start timestamp for the time range (Unix timestamp in seconds)
1704067200
End timestamp for the time range (Unix timestamp in seconds)
1704153600
Statistical aggregations to include in the response. Can be specified multiple times. Available values: avg, stddev, max, min, p50, p95, p96, p97, p98, p99. Specify parameter multiple times for multiple values (e.g., ?aggs[]=avg&aggs[]=p50).
avg, stddev, max, min, p50, p95, p96, p97, p98, p99 Metric types to include in the response. Can be specified multiple times. Available values: cpu, memory, disk, inodes, swap, memory_pressure, cpu_pressure, io_pressure, irq_pressure. Specify parameter multiple times for multiple values (e.g., ?types[]=cpu&types[]=memory).
cpu, memory, disk, inodes, swap, memory_pressure, cpu_pressure, io_pressure, irq_pressure Response
Successfully retrieved service-specific resource metrics with time-series data
Data granularity in seconds
5
Query start timestamp
1704067200
Query end timestamp
1704153600
Project identifier
"abc123def456"
Environment identifier
"main"
Branch machine name
"main-bvxea6i"
Service name
"admin-pipeline--kafka-profile-payloads"
Time-series resource utilization data organized by timestamp with instance-level metrics
Show child attributes
Show child attributes
DG2 host type mapping per instance. Only present for DG2 environments. Maps instance names to their host type ("web", "unified", or empty string).
Show child attributes
Show child attributes
{
"app.0": "web",
"app.1": "unified",
"worker.0": ""
}
Was this page helpful?