Network Metrics
Network metrics help investigate HTTP traffic, status codes, most accessed routes, latency, user agents, and source IPs. These endpoints are available for HTTP projects on plans that include metrics access.
Required permissions
| Endpoints | Minimum scope |
|---|---|
summary, status-codes, routes, and user-agents | project.metrics.read on project:<project-id> |
request-events and source-ips | project.network.visitors.read on project:<project-id> |
visitors | project.network.visitors.read on project:<project-id> |
request-events and source-ips return each visitor's source IP and user agent, so they require their own permission. project.metrics.read does not grant access to them: the query responds 403, with no masked version. owner has full access; assistant, member, and organization API Keys need the matching scope, and project.network.visitors.read is not part of the assistant initial template. AI assistant connections through MCP only query the aggregated endpoints.
In Preview environments, the permission is checked on the Preview's main project.
Headers
| Header | Required | Description |
|---|---|---|
x-api-key or Authorization | Yes | Organization API Key or user token |
x-organization-id | With a user token | Active project organization. Not needed with an organization API key |
Endpoints
| Endpoint | Main use |
|---|---|
GET /v1/project/:id/metrics/network/summary | Aggregated view of requests, bytes, latency, and status classes |
GET /v1/project/:id/metrics/network/status-codes | Grouping by HTTP status code |
GET /v1/project/:id/metrics/network/routes | Most accessed routes and status codes by route |
GET /v1/project/:id/metrics/network/user-agents | Most frequent user agents |
GET /v1/project/:id/metrics/network/request-events | Individual request events |
GET /v1/project/:id/metrics/network/source-ips | Source IPs with the highest volume |
GET /v1/project/:id/metrics/network/visitors | Visitors, page views, top pages, referrers and countries for the period (query range_seconds and tz); the period is limited by your plan's history |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Project ID |
Query Filters
| Parameter | Type | Description |
|---|---|---|
range_seconds | number | Relative window. Accepted values: 300, 3600, 21600, 86400, 604800 |
from | string | Start date in ISO 8601 format. Must be earlier than or equal to to |
to | string | End date in ISO 8601 format |
status_code | string | Specific HTTP status code, such as 500 |
status_class | string | HTTP class: 2xx, 3xx, 4xx, or 5xx |
source_ip | string | Source IP used to filter events |
path | string | HTTP path used to filter events |
page | number | Pagination page. Default: 1, maximum: 10000 |
limit | number | Items per page. Default: 5, maximum: 50 |
Use
range_secondsfor simple dashboards. Usefromandtowhen you need to compare a specific incident window.
Without range_seconds, from, or to, the query uses the last 24 hours. The maximum window is 7 days counted back from to: an older from is adjusted to that limit.
Summary
GET /v1/project/:id/metrics/network/summary{
"status": "success",
"message": "get network analytics summary with success",
"data": {
"project_id": "507f1f77bcf86cd799439011",
"window": {
"from": "2026-05-23T13:00:00.000Z",
"to": "2026-05-23T14:00:00.000Z",
"seconds": 3600
},
"summary": {
"requests": 1200,
"bytes_received": 420000,
"bytes_sent": 1800000,
"avg_latency_ms": 42,
"p95_latency_ms": 120
},
"status_classes": {
"2xx": 1160,
"3xx": 20,
"4xx": 15,
"5xx": 5
}
}
}Paginated Lists
The status-codes, routes, user-agents, request-events, and source-ips endpoints return data and pagination.
{
"status": "success",
"message": "get network analytics status codes with success",
"data": {
"data": [
{
"status_code": "200",
"requests": 1160,
"user_agents": {
"Mozilla/5.0": 900,
"curl/8.0": 260
},
"routes": {
"GET /": 800,
"GET /health": 360
},
"bytes_received": 390000,
"bytes_sent": 1600000,
"avg_latency_ms": 39,
"p95_latency_ms": 110
}
],
"pagination": {
"page": 1,
"limit": 5,
"total": 1,
"total_pages": 1
}
}
}Request events
Each request-events item represents a request received by the application:
{
"status": "success",
"message": "get network analytics request events with success",
"data": {
"data": [
{
"timestamp": "2026-05-23T13:58:12.000Z",
"source_ip": "203.0.113.10",
"method": "GET",
"path": "/",
"status_code": "200",
"bytes_received": 320,
"bytes_sent": 1540,
"user_agent": "Mozilla/5.0",
"latency_ms": 38
}
],
"pagination": {
"page": 1,
"limit": 5,
"total": 1,
"total_pages": 1
}
}
}source-ips returns items with source_ip and requests, sorted by request volume.
Examples
Last-hour summary
curl -X GET "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/metrics/network/summary?range_seconds=3600" \
-H "x-api-key: your-api-key" \
-H "x-organization-id: your-organization-id"Routes with 5xx errors
curl -X GET "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/metrics/network/routes?status_class=5xx&limit=10" \
-H "x-api-key: your-api-key" \
-H "x-organization-id: your-organization-id"Events for a specific IP
Requires project.network.visitors.read.
curl -X GET "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/metrics/network/request-events?source_ip=203.0.113.10" \
-H "x-api-key: your-api-key" \
-H "x-organization-id: your-organization-id"Python
import requests
API_KEY = "your-api-key"
ORGANIZATION_ID = "your-organization-id"
PROJECT_ID = "507f1f77bcf86cd799439011"
headers = {"x-api-key": API_KEY, "x-organization-id": ORGANIZATION_ID}
summary = requests.get(
f"https://api.zenifra.com/v1/project/{PROJECT_ID}/metrics/network/summary",
params={"range_seconds": 3600},
headers=headers
).json()
print(summary)Common Errors
| Code | Likely reason | How to fix |
|---|---|---|
400 | Invalid parameter, such as range_seconds outside the list, a date not in ISO 8601 format, or from later than to | Review the query filters |
402 | Plan does not allow metrics access | Upgrade to a plan with metrics enabled |
403 | Invalid organization or permission (insufficient organization permission) | Confirm x-organization-id and the scope required by the endpoint; request-events and source-ips require project.network.visitors.read |
422 | Project is not HTTP (code: "PROJECT_OPERATION_NOT_SUPPORTED") | Use database metrics in Metrics and Logs |
404 | Project not found | Check Project ID, API Key, and organization |
Next Steps
- Use Metrics and Logs for CPU, memory, and logs.
- Check Instances to correlate traffic with replicas.
- Review Deployment History when investigating incidents after deploys.
Last updated on