- API Reference
- Project
- Get a usage-metrics breakdown for a server
Get a usage-metrics breakdown for a server
Request
- serverIdstring (uuid)required
ID of the server whose usage-metrics breakdown is retrieved.
- metricstring (one of: cpu, memory)required
Resource metric to retrieve.
- fromstring (date-time)
Start of the time range.
- tostring (date-time)
End of the time range.
Responses
Usage-metrics breakdown for the server
- databasesarray of objectrequired
Absolute database usage (CPU seconds per second or memory bytes), labelled with
database_typeanddatabase_version.- Array[
- *object
- labelsobjectrequired
Prometheus labels identifying the series, e.g.
project,stack,container,database_typeordatabase_version; empty for an aggregated series.- *string
- samplesarray of objectrequired
- Array[
- *object
- timestring (date-time)required
- valuenumberrequired
]
]
- limitnumberrequired
Current server limit in the unit of the requested metric (CPU seconds per second or memory bytes).
- projectsarray of objectrequired
Usage per project relative to the server limit, labelled with
project.- Array[
- *object
- labelsobjectrequired
Prometheus labels identifying the series, e.g.
project,stack,container,database_typeordatabase_version; empty for an aggregated series.- *string
- samplesarray of objectrequired
- Array[
- *object
- timestring (date-time)required
- valuenumberrequired
]
]
Content-Type: application/json
{
"databases": [
{
"labels": {
"project": "p-XXXXXX"
},
"samples": [
{
"time": "2026-11-10T12:00:00.000Z",
"value": 0.42
}
]
}
],
"limit": 4,
"projects": [
{
"labels": {
"project": "p-XXXXXX"
},
"samples": [
{
"time": "2026-11-10T12:00:00.000Z",
"value": 0.42
}
]
}
]
}
{
"properties": {
"databases": {
"description": "Absolute database usage (CPU seconds per second or memory bytes), labelled with `database_type` and `database_version`.",
"items": {
"properties": {
"labels": {
"additionalProperties": {
"type": "string"
},
"description": "Prometheus labels identifying the series, e.g. `project`, `stack`, `container`, `database_type` or `database_version`; empty for an aggregated series.",
"example": {
"project": "p-XXXXXX"
},
"type": "object"
},
"samples": {
"items": {
"properties": {
"time": {
"example": "2026-11-10T12:00:00.000Z",
"format": "date-time",
"type": "string"
},
"value": {
"example": 0.42,
"type": "number"
}
},
"required": [
"time",
"value"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"labels",
"samples"
],
"type": "object"
},
"type": "array"
},
"limit": {
"description": "Current server limit in the unit of the requested metric (CPU seconds per second or memory bytes).",
"example": 4,
"type": "number"
},
"projects": {
"description": "Usage per project relative to the server limit, labelled with `project`.",
"items": {
"properties": {
"labels": {
"additionalProperties": {
"type": "string"
},
"description": "Prometheus labels identifying the series, e.g. `project`, `stack`, `container`, `database_type` or `database_version`; empty for an aggregated series.",
"example": {
"project": "p-XXXXXX"
},
"type": "object"
},
"samples": {
"items": {
"properties": {
"time": {
"example": "2026-11-10T12:00:00.000Z",
"format": "date-time",
"type": "string"
},
"value": {
"example": 0.42,
"type": "number"
}
},
"required": [
"time",
"value"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"labels",
"samples"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"projects",
"databases",
"limit"
],
"type": "object"
}
Validation Error caused by invalid input data in the request
- type"ValidationError"required
- messagestring
- validationErrorsarray of objectrequired
- Array[
- *object
- messagestringrequired
The standard error message
- pathstringrequired
The path to the part of the data that was validated. JavaScript property access notation (e.g., ".prop[1].subProp") is used.
- typestringrequired
ajv validation error type (e.g. "format", "required", "type") or own validation error types
- contextobject
The object with the additional information about the error that can be used to create custom error messages. Keys depend on the type that failed validation (e.g. "missingProperty" for type "required")
- *string
]
Content-Type: application/json
{
"type": "ValidationError",
"message": "Validation failed",
"validationErrors": [
{
"message": "should be string",
"path": ".address.street",
"type": "format",
"context": {
"format": "email"
}
}
]
}
{
"type": "object",
"required": [
"type",
"validationErrors"
],
"properties": {
"type": {
"type": "string",
"enum": [
"ValidationError"
]
},
"message": {
"type": "string",
"example": "Validation failed"
},
"validationErrors": {
"type": "array",
"items": {
"type": "object",
"required": [
"message",
"path",
"type"
],
"properties": {
"message": {
"type": "string",
"description": "The standard error message",
"example": "should be string"
},
"path": {
"type": "string",
"description": "The path to the part of the data that was validated. JavaScript property access notation (e.g., \".prop[1].subProp\") is used.\n",
"example": ".address.street"
},
"type": {
"type": "string",
"description": "ajv validation error type (e.g. \"format\", \"required\", \"type\") or own validation error types",
"example": "format"
},
"context": {
"type": "object",
"example": {
"format": "email"
},
"description": "The object with the additional information about the error that can be used to create custom error messages. Keys depend on the\ntype that failed validation (e.g. \"missingProperty\" for type \"required\")\n",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
The requested resource was not found
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
Your request ran into a rate limit. You have to wait until rate limit expires
- messagestring
- typestring
Content-Type: application/json
{
"message": "too many requests",
"type": "RateLimitError"
}
{
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "too many requests"
},
"type": {
"type": "string",
"example": "RateLimitError"
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
Usage examples
$ curl \
--fail \
--location \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
https://api.mittwald.de/v2/servers/f0f86186-0a5a-45b2-aa33-502777496347/usage-metrics/breakdown?metric=cpu&from=1985-10-26T01%3A21%3A00.000Z&to=1985-10-26T01%3A21%3A00.000Z
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";
const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.project.getServerUsageMetricsBreakdown({
"serverId": "f0f86186-0a5a-45b2-aa33-502777496347",
"queryParameters": {
"metric": "cpu",
"from": "1985-10-26T01:21:00.000Z",
"to": "1985-10-26T01:21:00.000Z"
}
});
assertStatus(response, 200);
use \Mittwald\ApiClient\Generated\V2\Clients\Project\GetServerUsageMetricsBreakdown\GetServerUsageMetricsBreakdownRequest;
$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));
$request = (new GetServerUsageMetricsBreakdownRequest(
serverId: "f0f86186-0a5a-45b2-aa33-502777496347"
))
->withMetric("cpu")
->withFrom("1985-10-26T01:21:00.000Z")
->withTo("1985-10-26T01:21:00.000Z");
$response = $client->project()->getServerUsageMetricsBreakdown($request);
var_dump($response->getBody();