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.
Headers
| Header | Required | Description |
|---|---|---|
x-api-key | Yes | Project API Key |
x-organization-id | Yes | Active project organization |
Endpoints
| Endpoint | Main use |
|---|---|
GET /project/:id/metrics/network/summary | Aggregated view of requests, bytes, latency, and status classes |
GET /project/:id/metrics/network/status-codes | Grouping by HTTP status code |
GET /project/:id/metrics/network/routes | Most accessed routes and status codes by route |
GET /project/:id/metrics/network/user-agents | Most frequent user agents |
GET /project/:id/metrics/network/request-events | Individual request events |
GET /project/:id/metrics/network/source-ips | Source IPs with the highest volume |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Project ID (ObjectId) |
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 |
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 |
limit | number | Items per page. Default: 5, maximum: 50 |
Use
range_secondsfor simple dashboards. Usefromandtowhen you need to compare a specific incident window.
Summary
GET /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
}
}
}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
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 | Project is not HTTP | Use database metrics in Metrics and Logs |
402 | Plan does not allow metrics access | Upgrade to a plan with metrics enabled |
403 | Invalid organization or permission | Confirm x-organization-id and project access |
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.