Sign Up
Metrics
GET /api/v1/metrics

Query aggregated metrics for a project. Supports filtering by time range, metric source, and custom queries.

Authorization
Authorization header required
Bearer token using your project API key.
Parameters
pid string<uuid> query required
Project ID to query metrics for.
data_type timeseries | aggregate query
Type of metric data to return (e.g. `timeseries`, `aggregate`).
query string query
Metric query expression. Use this for predefined metric queries.
query_sql string query
Raw SQL query for advanced metric queries.
since string query
Relative time range (e.g. `1h`, `24h`, `7d`).
from string<date-time> query
Start of absolute time range (ISO 8601).
to string<date-time> query
End of absolute time range (ISO 8601).
source string query
Metric source filter (e.g. `http`, `logs`, `traces`).
Responses
200 Metrics data returned successfully.
401 Missing or invalid authentication.
403 Insufficient permissions for this project.
422 Invalid query parameters.
Response Fields
series object[]
Array of time series data points.
series[].timestamp string<date-time>
Bucket timestamp.
series[].value number
Aggregated metric value.
series[].labels object
Label key-value pairs for this series.
metadata object
metadata.query string
The query that produced these results.
metadata.from string<date-time>
metadata.to string<date-time>
metadata.resolution string
Bucket resolution (e.g. `1m`, `5m`, `1h`).
curl -X GET "https://api.monoscope.tech/api/v1/metrics?pid=YOUR_PROJECT_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"
import requests

response = requests.get(
  "https://api.monoscope.tech/api/v1/metrics?pid=YOUR_PROJECT_ID",
  headers={
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  }
)
print(response.json())
const response = await fetch("https://api.monoscope.tech/api/v1/metrics?pid=YOUR_PROJECT_ID", {
  method: "GET",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  }
});
const data = await response.json();
console.log(data);
200 application/json
{
  "series": [
    {
      "timestamp": "2025-01-15T10:30:00Z",
      "value": 42,
      "labels": {
        "key": "example"
      }
    }
  ],
  "metadata": {
    "query": "example",
    "from": "2025-01-15T10:30:00Z",
    "to": "2025-01-15T10:30:00Z",
    "resolution": "example"
  }
}