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

HeaderRequiredDescription
x-api-keyYesProject API Key
x-organization-idYesActive project organization

Endpoints

EndpointMain use
GET /project/:id/metrics/network/summaryAggregated view of requests, bytes, latency, and status classes
GET /project/:id/metrics/network/status-codesGrouping by HTTP status code
GET /project/:id/metrics/network/routesMost accessed routes and status codes by route
GET /project/:id/metrics/network/user-agentsMost frequent user agents
GET /project/:id/metrics/network/request-eventsIndividual request events
GET /project/:id/metrics/network/source-ipsSource IPs with the highest volume

Path Parameters

ParameterTypeDescription
idstringProject ID (ObjectId)

Query Filters

ParameterTypeDescription
range_secondsnumberRelative window. Accepted values: 300, 3600, 21600, 86400, 604800
fromstringStart date in ISO 8601 format
tostringEnd date in ISO 8601 format
status_codestringSpecific HTTP status code, such as 500
status_classstringHTTP class: 2xx, 3xx, 4xx, or 5xx
source_ipstringSource IP used to filter events
pathstringHTTP path used to filter events
pagenumberPagination page. Default: 1
limitnumberItems per page. Default: 5, maximum: 50

Use range_seconds for simple dashboards. Use from and to when 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

CodeLikely reasonHow to fix
400Project is not HTTPUse database metrics in Metrics and Logs
402Plan does not allow metrics accessUpgrade to a plan with metrics enabled
403Invalid organization or permissionConfirm x-organization-id and project access
404Project not foundCheck Project ID, API Key, and organization

Next Steps